Periodically prune unneeded leftovers from docker
315
GitLab: https://gitlab.com/docker_repos/docker-prune-dockerized
DockerHub: https://hub.docker.com/r/mega349/docker-prune-dockerized
Periodically prune unneeded leftovers from docker, using cron and docker prune command.
The used command will be build from env vars:
docker $PRUNE_TYPE prune -f $PRUNE_PARAM
Using docker prune will delete resources depending on your setup!
With default settings, it will remove unused (including temporarily unused):
👉 Read the official documentation and proceed with caution!
version: '3.8'
services:
app:
image: mega349/docker-prune-dockerized:latest
restart: on-failure
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker:/var/lib/docker:ro
environment:
- TZ=Europe/Amsterdam
- CRON_TIME=*/5 * * * *
- USERNAME=root
- PRUNE_TYPE=system
- PRUNE_PARAM=--volumes # NOT default, but an example
| ENV | Description | Info | default value | NEEDED |
|---|---|---|---|---|
TZ | Your Timezone | Timezone identifier | Europe/Amsterdam | No |
CRON_TIME | Backup time in cron syntax | */5 * * * * | No | |
USERNAME | Run command as given user | root | No | |
PRUNE_TYPE | What type to prune | Take a look at Prune typs | system | No |
PRUNE_PARAM | Additional parameter for used prune command | Take a look at the official docker doku | No |
Please check the official doku for effects and additional parameter
| Type | Description | Official Doku |
|---|---|---|
system | everythink except volumes | system_prune |
network | only networks | network_prune |
image | only images | image_prune |
container | only container | container_prune |
volume | only volumes | volume_prune |
Content type
Image
Digest
sha256:9df110095…
Size
200.2 MB
Last updated
12 months ago
docker pull mega349/docker-prune-dockerized