Skip to content

Make the entrypoint readable for the unprivileged user - #367

Open
OvisMaximus wants to merge 1 commit into
admonstrator:mainfrom
OvisMaximus:fix-241-entrypoint-readable
Open

OvisMaximus wants to merge 1 commit into
admonstrator:mainfrom
OvisMaximus:fix-241-entrypoint-readable

Conversation

@OvisMaximus

Copy link
Copy Markdown
Contributor

Since #241, docker-entrypoint.sh drops privileges with gosu and then re-executes itself as PUID:PGID. The Dockerfile copies the script as root and only runs chmod +x, so the final mode depends on the build context. A context that provides the file without read permission for others (here: a Samba share with a restrictive create mask) produced mode 771. The kernel could exec the script as uid 1000, but /bin/sh could not read it:

/bin/sh: 0: cannot open /app/./docker-entrypoint.sh: Permission denied

The result was a container restart loop. CI builds from a Git checkout (644 → 755), which is why it never showed there.

Change: chmod 755 instead of chmod +x for docker-entrypoint.sh and start-services.sh.

Testing: On the affected host, stat -c '%a %U' /app/docker-entrypoint.sh showed 771 root before and 755 root after the rebuild. The container starts and the loop is gone.

🤖 Generated with Claude Code

Background
Since the upstream merge (admonstrator#241), docker-entrypoint.sh drops privileges with
gosu and then re-executes itself as PUID:PGID. The Dockerfile copies the
script without --chown (owned by root) and only adds the execute bit. A build
context that hands the file over without read permission for others - here a
Samba share with a restrictive create mask - produced mode 771 in the image.
The kernel could exec the script as uid 1000, but /bin/sh could not read it:
"cannot open /app/./docker-entrypoint.sh: Permission denied", and the
container restarted in a loop.

Changes
- Dockerfile: chmod 755 instead of chmod +x for docker-entrypoint.sh and
  start-services.sh, so the mode no longer depends on the build context.

Testing
On the affected host: stat on /app/docker-entrypoint.sh showed 771 root
before and 755 root after the rebuild; the container starts and the restart
loop is gone.

Impact
Images built from a Git checkout already got 755 and are unchanged. Images
built from a context without world-read permission start again.

Upstream Status
Proposed upstream with this change; relates to admonstrator#241.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant