Experience
Projects
My Stack
Case studies
Contact me
Open my CV

·6 min read

SQL Server built fine and could not start under Wings

The SQL Server image for my hosting panel built without a single warning, and it was useless. Started the way Pterodactyl's daemon starts containers, sqlservr failed with "Operation not permitted" on a file that was sitting right there with the executable bit set. Nothing in docker build could have told me that. This is the story of the one commit where I stopped trusting the build and made CI boot the image the way Wings does.

Project
Pterodactyl yolks
Date
Oct 2026
Stack
Docker, Shell, GitHub Actions
Commit
9a46108

What broke

Wings does not start a container the way docker run does on a laptop. It runs the process as an unprivileged user (uid 988 by default), drops a list of Linux capabilities, and sets no-new-privileges. I had already written the Dockerfile for that: a container user at uid 988, data under /home/container. The base image was Microsoft's mssql/server:2022-latest, and the first commit of the repo (bbbc922) added the image and the egg.

The image built. Under Wings' conditions it did not start, and the error pointed at the binary rather than at the platform. That is the worst kind of failure for a hosting product: the customer sees a server that will not start and a message that blames a file that exists.

There was a second problem hiding behind the first, and I only found it because I went looking for the first.

What the code showed

The cause is a Linux feature that is easy to forget. A file can carry capabilities in an extended attribute, security.capability. Microsoft's sqlservr carries cap_net_bind_service, which lets it bind ports below 1024. When a process executes a file whose capabilities exceed the container's bounding set, the kernel refuses the exec. Wings drops net_bind_service from every container, so a file asking for it cannot run. I wrote the explanation into the Dockerfile in the same commit, because I knew I would forget it:

Dockerfile
# sqlservr ships with the file capability cap_net_bind_service. Wings drops
# that capability from every container, and the kernel refuses to exec a
# binary whose file caps exceed the bounding set: "Operation not permitted".
# Rewriting each file drops the security.capability xattr; ports above 1024
# need no privilege anyway.
RUN find /opt/mssql /opt/mssql-tools* -type f -perm -u+x 2>/dev/null | while read -r f; do \
      cp "$f" "$f.nocap" && chmod --reference="$f" "$f.nocap" && mv -f "$f.nocap" "$f"; \
    done

Copying a file creates a new one without the extended attribute, and mv puts it back under the old name. Nothing here needs the privileged port: Wings hands each server a high port in SERVER_PORT.

The second problem was in the entrypoint. It expanded the panel's startup string like this:

bash
PARSED=$(echo "${STARTUP:-/opt/mssql/bin/sqlservr}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)")

The panel can prefix the startup line with commands of its own, a console banner. eval echo runs those commands inside a command substitution and then hands their output back as the command to execute. So the banner was not printed, it was run, and whatever it produced became the thing I tried to start.

The fix

Commit 9a46108 (Oct 2026) changed three files. The Dockerfile got the capability rewrite above. The entrypoint stopped using eval echo and now only rewrites the {{VAR}} placeholders with sed, then runs the result as a script in its own session:

bash
MODIFIED_STARTUP=$(printf '%s' "${STARTUP:-/opt/mssql/bin/sqlservr}" | sed -e 's/{{/${/g' -e 's/}}/}/g')
setsid bash -c "${MODIFIED_STARTUP}" </dev/null &

The third change matters most for the future: the CI workflow. Before it, the pipeline built and pushed. After it, the pipeline builds a test image first and boots it with Wings' uid, a long list of dropped capabilities (including net_bind_service), no-new-privileges, a tty, a 2304 MB memory limit and a startup line with a banner in front of it. The workflow comment states the rule: nothing is pushed unless SQL Server reaches "ready" and answers a query.

  1. 01

    Build for test

    linux/amd64 image, loaded locally as mssql-test:ci

  2. 02

    Boot like Wings

    uid 988, capabilities dropped, no-new-privileges, tty, memory limit

  3. 03

    Wait for ready

    up to 90 checks, 2 seconds apart, for the SQL Server ready line

  4. 04

    Check the banner

    the log must contain the banner text, printed and not executed

  5. 05

    Ask a question

    sqlcmd runs SELECT @@VERSION against the allocated port

  6. 06

    Stop it

    an INT signal, then check how the container exits

Figure 1. What the boot test does before anything is pushed.

The banner check is deliberate. The test startup line carries a banner that prints RENODE BANNER OK, and the job greps the log for it. If I ever bring back eval echo, the build goes red.

A server that fails has to take the container down

Four minutes later, 7386ccb (Oct 2026) fixed what the same kind of test pointed at. The entrypoint read panel console lines in a foreground loop, which kept the container alive even when SQL Server had died, and Wings would show "starting" for ever. The loop moved to the background, with stdin passed explicitly through file descriptor 3 because a background job would otherwise read /dev/null, and the script now ends with wait "$PID" and exit $?.

It came with a "Failure exits" CI step. The first version started the image with ACCEPT_EULA=N. Two minutes later a32db89 replaced that with a startup of echo failing on purpose; exit 3 and an assertion on the exact result, exit=3 running=false. A check that only proves "it stopped" can pass for the wrong reason, and an exit code cannot.

What I would do differently

I would write the boot test first, before the Dockerfile. I found Wings' rules by running into them one at a time. The conditions are known and fixed, so a test that reproduces them is a few lines of docker run flags, and it would have caught both problems on the first push.

I would also keep the dropped capability list in one place that the egg and the test share, so they cannot drift apart. Today the list lives in the workflow, and the rest of the knowledge lives in my head and in a Dockerfile comment.

Where this fits

This is one of several failures that shaped how all my Pterodactyl images are tested. The same capability fix, the same banner rule and the same boot step appear in the other repos, and the full yolks case study walks through all of them, plus the MySQL, Stalwart and n8n problems.

Open the Dockerfile and the workflow side by side to see the capability rewrite and the Wings-style boot test.

View the image on GitHub

#docker#pterodactyl#sql-server#ci#security

Keep reading

Have a project in mind?