Cleanup #
Stack updates and deployments often leave older images, and sometimes old volumes behind. In normal operation, that isn’t a problem - occasional manual cleanup using the Quantum Console is more than enough.
**Please note:** Docker Swarm rollbacks don't work if the old images got deleted. And even for manual rollbacks, it's easier if the images stay on the endpoint for a while. So don't run automatic cleanups if you don't absolutely need it or add a sufficient delay to them.
If you use apps that start and stop a lot of docker containers (like CI/CD
systems), you should consult the systems documentation first, but otherwise
consider automatic cleanup, using a periodically-running container that runs
docker system prune
.
Example #
Use the following stack as an example: prune images from your nodes every
72 hours (72h
). The interval may seem arbitary, but we suggest you make to
make it longer than a weekend — fine tune to your needs.
version: "3.8"
services:
system-prune:
image: docker:20.10.23
command: docker system prune --force
deploy:
mode: global
replicas: 0
restart_policy:
delay: 48h
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw