Add background cleanup process
When given the "run" argument, in addition to launching `podman system service` in the background, also start a small periodic maintenance script. It's only job is to clean up stale images, containers, and volumes from old jobs. Currently hard-coded to trigger every 2 days, this could be tweaked via build-args or env. var. Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
@@ -86,13 +86,14 @@ RUN if [[ "$RUNNER_LISTEN_ADDRESS" == "disabled" ]]; then \
|
||||
|
||||
# A small wrapper is needed to launch a background podman system service
|
||||
# process for the gitlab-runner to connect to.
|
||||
ADD /gitlab-runner-wrapper /usr/local/bin/
|
||||
ADD /gitlab-runner-wrapper /podman-in-podman-maintenance /usr/local/bin/
|
||||
# Base image UTS NS configuration causes runner to break when launching
|
||||
# nested rootless containers.
|
||||
RUN sed -i -r \
|
||||
-e 's/^utsns.+host.*/utsns="private"/' \
|
||||
/etc/containers/containers.conf && \
|
||||
chmod +x /usr/local/bin/gitlab-runner-wrapper && \
|
||||
chmod +x /usr/local/bin/podman-in-podman-maintenance && \
|
||||
chown -R podman.podman /home/podman && \
|
||||
rm -f /home/podman/.bash* && \
|
||||
echo DOCKER_HOST="unix:///tmp/podman-run-1000/podman/podman.sock" > /etc/profile.d/podman.sh
|
||||
|
||||
Reference in New Issue
Block a user