File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,14 @@ mkdir -p out/
6161# we run all builds with non-privileged user accounts to make sure the build doesn't depend on such features
6262uid=" $( id -u) "
6363
64+ # When running under Podman (on hosts where `docker` is a shim that invokes `podman`),
65+ # UID/GID mappings may lead to permission errors when copying artifacts to `/out`.
66+ # We set the user namespace mode to `keep-id` to make sure that the host UID/GID
67+ # are mapped to the same values inside the container, but using this environment
68+ # variable (a) to not affect builds using Docker, and (b) to allow overriding the
69+ # user namespace mode easily if necessary.
70+ export PODMAN_USERNS=" ${PODMAN_USERNS:- keep-id} "
71+
6472# note: we cannot just use '-e ARCH', as this wouldn't overwrite the value set via ENV ARCH=... in the image
6573common_docker_opts=(
6674 -e TERM=" $TERM "
7987# TODO: make gnupg home available, e.g., through "-v" "$HOME"/.gnupg:/root/.gnupg
8088# TODO: this ^ won't work since we don't build as root any more
8189# note: we enforce using the same UID in the container as outside, so that the created files are owned by the caller
82- env PODMAN_USERNS=${PODMAN_USERNS:- keep-id} \
8390docker run --rm \
8491 --user " $uid " \
8592 " ${common_docker_opts[@]} " \
You can’t perform that action at this time.
0 commit comments