Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9ce0c3a

Browse files
authoredAug 23, 2022
Rollup merge of #100930 - cuviper:podman-keep-id, r=jyn514
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.
2 parents d9fd2c4 + 4eb748b commit 9ce0c3a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎src/ci/docker/run.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,16 @@ else
213213
args="$args --volume $HOME/.cargo:/cargo"
214214
args="$args --volume $HOME/rustsrc:$HOME/rustsrc"
215215
args="$args --volume /tmp/toolstate:/tmp/toolstate"
216-
args="$args --env LOCAL_USER_ID=`id -u`"
216+
217+
id=$(id -u)
218+
if [[ "$id" != 0 && "$(docker -v)" =~ ^podman ]]; then
219+
# Rootless podman creates a separate user namespace, where an inner
220+
# LOCAL_USER_ID will map to a different subuid range on the host.
221+
# The "keep-id" mode maps the current UID directly into the container.
222+
args="$args --env NO_CHANGE_USER=1 --userns=keep-id"
223+
else
224+
args="$args --env LOCAL_USER_ID=$id"
225+
fi
217226
fi
218227

219228
if [ "$dev" = "1" ]

0 commit comments

Comments
 (0)
Please sign in to comment.