Repository navigation
fix(docker): install binaries outside /root so the image runs as non-root - #599
Open
sebastianst wants to merge 1 commit into
Open
sebastianst wants to merge 1 commit into
sebastianst wants to merge 1 commit into
Conversation
…root The runtime image copied `contender` and `anvil` into `/root/.cargo/bin`. `/root` is mode 0700, so `docker run --user <uid>:<gid>` failed with `exec: "contender": executable file not found in $PATH`, which forced containers to run as root and left root-owned files in mounted data dirs. Install them into `/usr/local/bin`, drop the PATH override, and drop the `/root/.contender` mkdir: that is the legacy data dir, and creating it only triggers the migration to `~/.local/state/contender`. Document running as the host user. The default user stays root, so existing mounts keep working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The image installs
contenderandanvilinto/root/.cargo/bin, and/rootis mode 0700. So the image can't run as any user other than root:Containers therefore have to run as root, and on Linux every file contender writes into a mounted data dir comes out root-owned on the host. We hit this in Kupcake, which runs every other service as the host user.
Solution
/usr/local/binand drop thePATHoverride.mkdir -p /root/.contender. That's the legacy data dir, and creating it only triggers the migration to~/.local/state/contender. The comment now points at the current data dir.CONTENDER_DATA_DIR.The default user stays root, so the documented
-v …:/root/.local/state/contendermount keeps working.Tested on a locally built image, running as
--user $(id -u):$(id -g) --cap-drop ALL:anvil,contender spam … transfersandcontender reportall ran, and every file in the data dir was owned by the host user.PR Checklist
cargo +nightly clippy …: n/a, no Rust changescargo fmt --all: n/a/root/.cargo/bin/contenderby its full path🤖 Co-created with Claude Opus 5.5