·5 min read
The n8n image had no bash, so my entrypoint became POSIX sh
The entrypoints in my Pterodactyl images share a pattern: a bash script, and setsid to put the server in its own session so shutdown can signal it. For n8n I used the pattern again and added a line to install what the base image might be missing. That was the wrong assumption. The official n8n image has no package manager and no bash, so there was nothing to install it with.
- Project
- Pterodactyl yolks
- Date
- Oct 2026
- Stack
- Docker, POSIX sh, n8n
- Commit
- 394b22f
What broke
The first commit for this image (211c621, Oct 2026) was written like the others. The Dockerfile installed what the entrypoint would need and registered the Wings user:
RUN apk add --no-cache bash util-linux-misc \
&& grep -q ":${CONTAINER_UID}:" /etc/group || echo "container:x:${CONTAINER_UID}:" >> /etc/group \
&& grep -q ":x:${CONTAINER_UID}:" /etc/passwd || echo "container:x:${CONTAINER_UID}:${CONTAINER_UID}::/home/container:/bin/bash" >> /etc/passwd \
&& mkdir -p /home/container && chown ${CONTAINER_UID}:${CONTAINER_UID} /home/containerThe entrypoint began with #!/bin/bash and launched n8n with setsid bash -c "${MODIFIED_STARTUP}", so that on shutdown I could signal the shell and n8n together by signaling the whole process group. That is the shape every other entrypoint in the set has.
It does not work on this base. The n8n 2.x image ships without a package manager, so there is nothing to run apk add with, and without bash the entrypoint has no interpreter. The Dockerfile comment added in the second fix commit says so plainly.
What the code showed
The lesson is about order. I had written the entrypoint first and assumed the base would accommodate it. The base image should have been read first: what shell is there, what does the user database look like, what can I add and what can I not. The commit message and the Dockerfile comment record the answer: /bin/sh, and no way to add anything.
That constraint ripples. The old entrypoint used bash -c and setsid, and I could install neither. So the script had to be something a minimal shell can run, and the shutdown logic that depended on setsid had to change.
The fix
The fix was two commits within three minutes. 394b22f (Oct 2026) switched the interpreter in both places that name it:
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]#!/bin/sh
# POSIX sh: the n8n image carries no bash and no package manager to add one.The second commit, 366c74f, removed the apk add line from the Dockerfile and changed the passwd entry's login shell from /bin/bash to /bin/sh, with a comment that n8n 2.x ships without a package manager or bash.
The trickier change was shutdown. With setsid, I could kill the group: kill -TERM -- "-$PID". Without it, n8n's startup shell and n8n itself sit in the container's one existing process tree, and I needed a reliable way to reach both:
sh -c "${MODIFIED_STARTUP}" </dev/null &
PID=$!
# This script is PID 1, so `kill -1` reaches every other process in the
# container: the startup shell and n8n under it, whatever the tree looks like.
shutdown() {
echo "Stopping n8n..."
kill -TERM -1 2>/dev/null
wait "$PID"
exit $?
}
trap shutdown INT TERMkill -TERM -1 sends the signal to every process the caller is allowed to signal. Inside a container, with my script as PID 1, that is the startup shell and n8n under it, however the tree is shaped. The comment in the file says "kill -1" where the command says -TERM -1, a small slip I would tidy. The script then waits for the process it started and exits with its status, so the container ends exactly when n8n does.
The CI workflow for this repo was built the same way as the others from the start: boot as uid 988 with Wings' dropped capabilities and a banner prefixed on the startup line, and a "Failure exits" step with echo failing on purpose; exit 3 that must end as exit=3 running=false. That is what lets the shell change be safe. The sh entrypoint is checked by the same boot test as everything else.
What I would do differently
I would read the base image before writing a line of entrypoint. A docker run --rm --entrypoint sh image -c 'ls /bin; cat /etc/passwd' takes ten seconds and answers every question that cost me two commits.
I would also write all my entrypoints as POSIX sh where they can be, not only where I am forced to. kill -TERM -1 is a heavy tool, and it is only correct because this script is PID 1 in a container that holds nothing else. If someone ran this entrypoint outside a container, the same line would signal every process the user owns. A dependency on being PID 1 should be written down and tested, not just remembered.
Where this fits
This is the one image in the set that taught me to check what the base provides before copying a pattern. The rest follow the same Wings conventions, and the full yolks case study shows how the entrypoints, the capability fix and the boot test fit together across all of them.
The entrypoint is under fifty lines of plain sh, a good small example of running a service as PID 1 without bash.
View the image on GitHub#docker#shell#n8n#pterodactyl#posix
Keep reading
Have a project in mind?