Repository navigation
feat(docker): run as the host user via MW_UID/MW_GID - #2189
Open
Hermsi1337 wants to merge 8 commits into
Open
Hermsi1337 wants to merge 8 commits into
Hermsi1337 wants to merge 8 commits into
Conversation
Install openssh-client and rsync, bind port forwardings to the container interface and document how to pass the ssh key. Closes #2182
Allocate a TTY only when interactive, fail on missing keys instead of creating a directory, make the key configurable, warn about host networking and document root-owned downloads. CI now checks that ssh, scp, ssh-keygen, rsync and GatewayPorts are in the image.
Hermsi1337
force-pushed
the
feat/docker-host-uid
branch
from
November 1, 2026 10:35
0bd6fbd to
a8ec146
Compare
usermod printed "no changes" to stdout when MW_UID matched the mw user, which broke JSON output. Also drop lastlog/faillog so usermod does not create huge sparse files for large UIDs.
Hermsi1337
force-pushed
the
feat/docker-host-uid
branch
from
November 1, 2026 11:20
a8ec146 to
c7729c1
Compare
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.
Closes #2188
Stacked on #2183 (needs the SSH tooling), so the base is
feat/docker-ssh-support.mwuser anddocker/entrypoint.shas entrypointMW_UID(and optionallyMW_GID, defaults toMW_UID) the entrypoint movesmwto those IDs viausermod/groupmod --non-uniqueand starts the CLI throughsetprivwithHOME=/home/mw.setprivis already in the base image, so no extra package like gosu-e MW_UID="$(id -u)" -e MW_GID="$(id -g)", and the key is now mounted at/ssh/...instead of/root/.ssh/...so the non-root user can read it1234:2345when the variables are setSame idea as the entrypoint in
mittwald/golangci-lint-cfg, except the GID is separate (on macOS UID and GID differ, e.g.501:20).Tested on Docker Desktop (arm64) with an image built from this branch and the v1.28.1 tarball:
--versionandproject listwith and withoutMW_UID, also with an already existing GID (MW_GID=20)container execagainst a real container as UID 1234, key from/ssh/keyviaMITTWALD_SSH_IDENTITY_FILE1234:23450:0)container cponly picks up the key from/ssh/...together with #2187, since cp ignored--ssh-identity-fileso far.Follow-ups after testing:
usermodprintedusermod: no changesto stdout whenMW_UIDmatched the mw user (UID 1000, the most common Linux UID), which broke-o jsonpiping. Its output is discarded now, and CI checks that--versionprints exactly one line in that caseMW_UID/MW_GIDmust be numeric, otherwise the entrypoint fails with a clear message instead of a groupmod error about a group ID/var/log/lastlogandfaillogare removed anduseradd --no-log-initis used, sousermodwith large UIDs (LDAP/AD) doesn't create huge sparse files in the container layerubuntuuser (UID 1000 on 24.04+) is removed somwkeeps UID 1000 after the rebase onto chore(docker): update base image to ubuntu 26.04 #2185