From 72784bc11a85ee77f5e28cf653be5765f17a62bd Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sun, 5 Mar 2023 21:33:02 -0900 Subject: [PATCH] Add note about docker image cleanup (#1597) Closes #1532 Adds notes about images not being cleaned up by wood-pecker and provides examples on how you can automate the cleanup. Also provides a warning that these are destructive actions. CleanShot 2023-03-03 at 09 36 35@2x --------- Co-authored-by: Anbraten --- .../22-backends/10-docker.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/docs/30-administration/22-backends/10-docker.md b/docs/docs/30-administration/22-backends/10-docker.md index f69d16186..48ffcc4ec 100644 --- a/docs/docs/30-administration/22-backends/10-docker.md +++ b/docs/docs/30-administration/22-backends/10-docker.md @@ -35,3 +35,25 @@ RUN apk add -U --no-cache docker-credential-ecr-login ## Podman support While the agent was developed with Docker/Moby, Podman can also be used by setting the environment variable `DOCKER_SOCK` to point to the Podman socket. In order to work without workarounds, Podman 4.0 (or above) is required. + +## Image Cleanup + +The agent **will not** automatically remove images from the host. This task should be managed by the host system. For example, you can use a cron job to periodically do clean-up tasks for the CI runner. + +:::danger + +The following commands **are destructive** and **irreversible** it is highly recommended that you test these commands on your system before running them in production via a cron job or other automation. + +::: + +### Remove all unused images + +```sh +docker image rm $(docker images --filter "dangling=true" -q --no-trunc) +``` + +### Remove Woodpecker Volumes + +```sh +docker volume rm $(docker volume ls --filter name=^wp_* --filter dangling=true -q) +```