@@ -288,24 +288,29 @@ args="$args --privileged"
288
288
# `LOCAL_USER_ID` (recognized in `src/ci/run.sh`) to ensure that files are all
289
289
# read/written as the same user as the bare-metal user.
290
290
if [ -f /.dockerenv ]; then
291
- docker create -v /checkout --name checkout alpine:3.4 /bin/true
291
+ docker create -v /checkout --name checkout ghcr.io/rust-lang/ alpine:3.4 /bin/true
292
292
docker cp . checkout:/checkout
293
293
args=" $args --volumes-from checkout"
294
294
else
295
295
args=" $args --volume $root_dir :/checkout$SRC_MOUNT_OPTION "
296
296
args=" $args --volume $objdir :/checkout/obj"
297
297
args=" $args --volume $HOME /.cargo:/cargo"
298
298
args=" $args --volume /tmp/toolstate:/tmp/toolstate"
299
+ fi
299
300
300
- id=$( id -u)
301
- if [[ " $id " != 0 && " $( docker version) " =~ Podman ]]; then
302
- # Rootless podman creates a separate user namespace, where an inner
303
- # LOCAL_USER_ID will map to a different subuid range on the host.
304
- # The "keep-id" mode maps the current UID directly into the container.
305
- args=" $args --env NO_CHANGE_USER=1 --userns=keep-id"
306
- else
307
- args=" $args --env LOCAL_USER_ID=$id "
308
- fi
301
+ id=$( id -u)
302
+ if [[ " $id " != 0 && " $( docker version) " =~ Podman ]]; then
303
+ # Rootless podman creates a separate user namespace, where an inner
304
+ # LOCAL_USER_ID will map to a different subuid range on the host.
305
+ # The "keep-id" mode maps the current UID directly into the container.
306
+ args=" $args --env NO_CHANGE_USER=1 --userns=keep-id"
307
+ elif [[ " $id " != 0 ]]; then
308
+ # We are running in docker as non-root
309
+ args=" $args --env LOCAL_USER_ID=$id "
310
+ else
311
+ # We are running as root. Since we don't want to run the container as root,
312
+ # we set id `1001` instead of `0`.
313
+ args=" $args --env LOCAL_USER_ID=1001"
309
314
fi
310
315
311
316
if [ " $dev " = " 1" ]
0 commit comments