38 lines
688 B
YAML
38 lines
688 B
YAML
|
version: "3.8"
|
||
|
|
||
|
services:
|
||
|
docker-cleanup:
|
||
|
image: docker.io/docker:latest
|
||
|
cap_drop:
|
||
|
- ALL
|
||
|
|
||
|
volumes:
|
||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||
|
|
||
|
entrypoint: []
|
||
|
command:
|
||
|
- "sh"
|
||
|
- "-euc"
|
||
|
- |
|
||
|
while true; do
|
||
|
docker image prune --all --force
|
||
|
docker system prune --all --force --volumes
|
||
|
|
||
|
sleep 86400
|
||
|
## 1 day, in seconds
|
||
|
done
|
||
|
|
||
|
deploy:
|
||
|
mode: global
|
||
|
|
||
|
resources:
|
||
|
limits:
|
||
|
cpus: "1.0"
|
||
|
memory: "1G"
|
||
|
|
||
|
restart_policy:
|
||
|
condition: on-failure
|
||
|
delay: 5s
|
||
|
max_attempts: 3
|
||
|
window: 120s
|