[gnome-initial-setup/wjt/use-gnome-desktop-4: 1/3] ci: When using podman, be uid 0 in container




commit acc679e867660615cf1410f8f1a83934164084c6
Author: Will Thompson <will willthompson co uk>
Date:   Thu Dec 16 21:03:16 2021 +0000

    ci: When using podman, be uid 0 in container
    
    With podman, your real UID on the host is mapped to UID 0 in the
    container. So the source directory mounted with '-v' ends up owned as
    root, but the default user inside the container is something else.

 .gitlab-ci/run-docker.sh | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
index 420b1d48..c1f2a6e3 100755
--- a/.gitlab-ci/run-docker.sh
+++ b/.gitlab-ci/run-docker.sh
@@ -91,10 +91,12 @@ if [ ! -x "$(command -v docker)" ] || (docker --help |& grep -q podman); then
         # CI runners.
         echo "Using: Podman"
         format="--format docker"
+        user=("--user" "0")
         CMD="podman"
 else
         echo "Using: Docker"
         format=""
+        user=()
         CMD="sudo docker"
 fi
 
@@ -125,6 +127,7 @@ fi
 if [ $run == 1 ]; then
         echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
         ${CMD} run \
+                "${user[@]}" \
                 --rm \
                 --volume "$(pwd)/..:/home/user/app" \
                 --workdir "/home/user/app" \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]