diff --git a/Containerfile b/Containerfile index 5316c12..9771f1c 100644 --- a/Containerfile +++ b/Containerfile @@ -97,7 +97,8 @@ RUN sed -i -r \ chown -R podman:podman /home/podman && \ chmod u+s /usr/bin/new{uid,gid}map && \ rm -f /home/podman/.bash* && \ - echo DOCKER_HOST="unix:///tmp/podman-run-1000/podman/podman.sock" > /etc/profile.d/podman.sh + echo DOCKER_HOST="unix:///tmp/podman-run-1000/podman/podman.sock" > /etc/profile.d/podman.sh && \ + echo "podman:10000:10000" | tee /etc/subuid > /etc/subgid # Runtime rootless-mode configuration USER podman diff --git a/README.md b/README.md index db6a71a..ef11f8a 100644 --- a/README.md +++ b/README.md @@ -27,21 +27,20 @@ lacks this feature, Several labels are set on the image to support easy registration and execution of a runner container using a special bash command. See the examples below for more information. -#### [Volume Ownership Bug](https://github.com/containers/podman/issues/16576) +#### [Volume setup] -Some versions of podman contain a bug where named local volumes aren't owned -by the namespaced user within a rootless container (i.e. the 'podman' user). -Since the `podman` user/group inside the `pipglr` container is known, it's -possible to manually setup ownership ahead of time. This should be be done -once, prior to registering your runners: +Since podman inside the container runs as user `podman`, the volumes +used by it need to be pre-created with ownership information. While, +we're at it, might as well add the performance-improving `noatime`, +option as well. ```bash -$ for VOLUME in pipglr-podman-root pipglr-config pipglr-podman-cache; do \ +$ VOLOPTS="o=uid=1000,gid=1000,noatime"; \ + for VOLUME in pipglr-podman-root pipglr-config pipglr-podman-cache; do \ + podman volume create --opt $VOLOPTS $VOLUME || true ; \ VOLPTH=$(podman unshare podman volume mount $VOLUME) - podman volume create $VOLUME; \ - podman unshare chown -R 1000:1000 $VOLPTH && \ - podman unshare chmod 02770 $VOLPTH && \ - podman unshare ls -land $VOLPTH ; \ + podman unshare chown -c -R 1000:1000 $VOLPTH && \ + podman unshare chmod -c 02770 $VOLPTH && \ podman unshare podman volume unmount $VOLUME ; \ done ``` @@ -49,7 +48,7 @@ $ for VOLUME in pipglr-podman-root pipglr-config pipglr-podman-cache; do \ If you get `podman system service` startup permission-denied errors, or errors from gitlab-runner, unable to connect to the podman socket, this is likely the cause. You can fix it after-the-fact using the same commands -above. additionally target `./*`. +above. #### Runner registration @@ -112,6 +111,12 @@ For example, to display the config: $ podman unshare cat $(podman unshare podman volume mount pipglr-config)/config.toml ``` +Edit the config with your favorite `$EDITOR`: + +```bash +$ podman unshare $EDITOR $(podman unshare podman volume mount pipglr-config)/config.toml +``` + #### Debugging The first thing to check is the container output: @@ -120,9 +125,9 @@ The first thing to check is the container output: $ podman logs --since 0 pipglr ``` -Before starting the runner, you may `export PODMAN_RUNNER_DEBUG=debug` to enable -debugging on the inner-podman. Whereas `export LOG_LEVEL=debug` can be used to -debug the gitlab-runner itself. +Next, try running pipglr after an `export PODMAN_RUNNER_DEBUG=debug` to enable +debugging on the inner-podman. If more runner detail is needed, you can instead/additionally +set `export LOG_LEVEL=debug` to debug the gitlab-runner itself. ## Building