Skip to content

Commit 98a815b

Browse files
committed
Fix make test with podman by adding user namespace preservation during run.
1 parent 14096a4 commit 98a815b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

envhelp/dpython

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,21 @@ fi
8787

8888
echo "using image id $IMAGEID"
8989

90+
# Run as CONTAINER_USER_UID in container by default
91+
USER_ARGS="--user $CONTAINER_USER_UID"
92+
# It is necessary to preserve user namespaces in container on podman to avoid
93+
# root-owned repo contents in bind mount.
94+
if ${DOCKER_BIN} version | grep -q -i "podman"; then
95+
USER_ARGS="$USER_ARGS --userns=keep-id"
96+
fi
97+
echo "using user args $USER_ARGS"
98+
9099
# execute python within the image passing the supplied arguments
91100

92101
${DOCKER_BIN} run -it --rm \
93102
--mount "type=bind,source=$MIG_BASE,target=/usr/src/app" \
94103
--env "PYTHONPATH=$PYTHONPATH" \
95104
--env "PYTHONPYCACHEPREFIX=$PYTHONPYCACHEPREFIX" \
96105
--env "MIG_ENV=$MIG_ENV" \
97-
--user "$CONTAINER_USER_UID" \
106+
${USER_ARGS} \
98107
"$IMAGEID" "$DOCKER_PYTHON_BIN" $@

0 commit comments

Comments
 (0)