·5 min read
Putting Directus on a Pterodactyl panel: uid 1000, tini and a PUBLIC_URL
Directus ships an official Docker image, so putting it on a Pterodactyl panel should have been a one-line job. It was not, because a panel does not run an image the way Docker does. It runs your image as an unprivileged user, supplies its own startup command as a template, and expects a data directory it can mount. My Directus image for Wings is 38 lines of Dockerfile and a 44-line start script, and nearly every line exists to meet one of those expectations.
- Project
- Pterodactyl Yolks
- Date
- Oct 2026
- Stack
- Docker, Bash, Directus, Pterodactyl Wings, GitHub Actions
- Commit
- 3dcef72
Why not just install from npm
The Dockerfile's header comment gives the reason: the npm package needs a native build of sharp and sqlite3 per platform, and the official image already carries them. The workflow builds for linux/amd64 and linux/arm64, and building those native modules under emulation would be the slowest and most fragile part of the build. So the image starts FROM directus/directus:${DIRECTUS_VERSION}, with the version pinned by a build argument (12.5.0 in the matrix) and the release tagged app_directus and app_directus_12.
What gets added is the panel-shaped layer on top.
The uid 1000 problem
Wings runs containers as a user called container with home /home/container. The Directus base is a Node image, and Node images already use uid 1000 for a user named node. Two users cannot own the same uid, so the Dockerfile removes one and creates the other:
RUN apk add --no-cache bash tini iproute2 ca-certificates curl tzdata \
&& (deluser --remove-home node 2>/dev/null || true) \
&& adduser -D -u 1000 -h /home/container -s /bin/bash container \
&& echo "${DIRECTUS_VERSION}" > /directus/.renode-versionThe || true is there on purpose: if a future base image drops the node user, the build should not fail on deluser. The packages are the ones the entrypoint needs: bash because the start script uses it, tini for PID 1, iproute2 for the ip route call in the entrypoint, curl and ca-certificates for anything an extension fetches, and tzdata. The last line stores the version in a file so the entrypoint can print it.
The runtime defaults point everything stateful at the one directory the panel preserves:
ENV DB_CLIENT=sqlite3 \
DB_FILENAME=/home/container/database/data.db \
STORAGE_LOCATIONS=local \
STORAGE_LOCAL_ROOT=/home/container/uploads \
EXTENSIONS_PATH=/home/container/extensions \
TELEMETRY=falseSQLite, uploads and extensions all live under /home/container, so a server's data is one directory and backing it up is the panel's job, not Directus's.
Signals
Two lines handle shutdown: STOPSIGNAL SIGINT and ENTRYPOINT ["/sbin/tini", "-g", "--"]. tini runs as PID 1 and reaps children, and -g makes it forward signals to the whole process group, so the stop request reaches node and not only the shell wrapper that started it. The start script ends with exec node cli.js start, which replaces the shell with Node instead of leaving a shell between them.
The entrypoint copies the other yolks
The entrypoint is short and deliberately boring:
MODIFIED_STARTUP=$(echo -e ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')
echo -e "\033[1m\033[33mcontainer@pterodactyl~ \033[0m${MODIFIED_STARTUP}"
eval ${MODIFIED_STARTUP}A Pterodactyl egg supplies a STARTUP template with {{VARIABLE}} placeholders. This rewrites them into shell expansions and evals the result. A comment in the file says why it is a copy: it is the same expansion as the parkervcp yolks, so eggs written for those behave the same. It also exports INTERNAL_IP from ip route get 1. I would rather inherit a convention than invent a slightly different one that someone has to debug.
directus-start: panel variables to Directus settings
Directus reads a lot from the environment, and the start script only handles the cases where a panel user would otherwise be stuck.
It refuses to start without a secret, with a message that names the panel:
if [[ -z "${DIRECTUS_SECRET:-}" ]]; then
say "Renode: DIRECTUS_SECRET is empty. Set it on the Startup tab; Directus will not start without one."
exit 1
fi
export SECRET="$DIRECTUS_SECRET"
export KEY="${KEY:-$DIRECTUS_SECRET}"It maps DIRECTUS_ADMIN_PASSWORD to Directus's ADMIN_PASSWORD. And it derives the public address:
if [[ -n "${CMS_DOMAIN:-}" ]]; then
host="${CMS_DOMAIN#http://}"; host="${host#https://}"; host="${host%%/*}"
export PUBLIC_URL="https://${host}"
else
addr="${SERVER_IP:-}"
[[ -z "$addr" || "$addr" == "0.0.0.0" ]] && addr="localhost"
export PUBLIC_URL="${PUBLIC_URL:-http://${addr}:${PORT}}"
fiThe three parameter expansions strip a pasted http://, a pasted https:// and anything after the first slash, so https://cms.example.com/admin and cms.example.com both end up as https://cms.example.com. Without a domain it falls back to the server's address and port, treating 0.0.0.0 as localhost, since that is the allocation's bind address and not something a browser can open.
Then it runs node cli.js bootstrap before start. The header comment records the property that makes that safe on every boot: bootstrap creates the administrator on the first start and never touches an existing one, so later changes are made in the app.
The rename
The commit after the first release, a24ab6d, is a rename of the domain variable from DIRECTUS_DOMAIN to CMS_DOMAIN, in the header comment and in both places it is read. The commit does not say why, and I will not guess at a reason I cannot verify from the repo. What the diff does show is how much a variable's name is part of the interface. In a panel it is a field an operator sees and fills in, so renaming it means changing the egg that defines it as well as the script that reads it.
The monthly rebuild
The workflow runs on pushes that touch directus/**, on manual dispatch, and on a monthly cron (0 4 1 * *). The comment on the cron says it picks up base-image security updates. The matrix has fail-fast: false and per-version build cache scopes, which matters as soon as a second Directus version is added to the list.
What I took from it
Wrapping a well-made image for a panel is mostly a negotiation with the panel's conventions: who owns uid 1000, who forwards signals, who expands the startup string, where the data lives. Each answer is one or two lines, and getting any of them wrong shows up as a server that will not start, loses its data on restart, or ignores a stop button.
#docker#pterodactyl#bash#directus
Keep reading
Have a project in mind?