Skip to content

Commit

Permalink
Rollup merge of #100930 - cuviper:podman-keep-id, r=jyn514
Browse files Browse the repository at this point in the history
Use `--userns=keep-id` when "docker" is really podman

Rootless podman creates a separate user namespace, where an inner
`LOCAL_USER_ID` will map to a different subuid range on the host.
The "keep-id" mode maps the current UID directly into the container.

This makes `src/ci/docker/run.sh` work better for testing container
images on systems running podman, where "docker" is just a shim.
  • Loading branch information
JohnTitor authored Aug 24, 2022
2 parents 4dede7a + 4eb748b commit 8549096
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,16 @@ else
args="$args --volume $HOME/.cargo:/cargo"
args="$args --volume $HOME/rustsrc:$HOME/rustsrc"
args="$args --volume /tmp/toolstate:/tmp/toolstate"
args="$args --env LOCAL_USER_ID=`id -u`"

id=$(id -u)
if [[ "$id" != 0 && "$(docker -v)" =~ ^podman ]]; then
# Rootless podman creates a separate user namespace, where an inner
# LOCAL_USER_ID will map to a different subuid range on the host.
# The "keep-id" mode maps the current UID directly into the container.
args="$args --env NO_CHANGE_USER=1 --userns=keep-id"
else
args="$args --env LOCAL_USER_ID=$id"
fi
fi

if [ "$dev" = "1" ]
Expand Down

0 comments on commit 8549096

Please sign in to comment.