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.

<img width="1020" alt="CleanShot 2023-03-03 at 09 36 35@2x"
src="https://user-images.githubusercontent.com/64056131/222800658-f610d488-f8ea-4aca-8ed0-f26e44be1884.png">

---------

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
Hayden 2023-03-05 21:33:02 -09:00 committed by GitHub
parent d35ab57f80
commit 72784bc11a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
```