Just ran spotify/docker-gc and watched it delete every stopped container (sidekicks bye bye)… Just as a warning to everyone here.
The image on docker hub is eeacms/docker-gc
you can use it like this:
$ docker run --rm -e "DRY_RUN=true" -v /var/run/docker.sock:/var/run/docker.sock -v /etc:/etc eeacms/docker-gc:v1.2
or to exclude some container and images:
docker run --privileged=true --rm -e "DRY_RUN_CONTAINERS=true" -e "EXCLUDE_CONTAINERS=data mysql" -e "EXCLUDE_IMAGES=alpine busybox" -v /var/run/docker.sock:/var/run/docker.sock eeacms/docker-gc:v1.2
Thanks @demarant did you try to pull request these enhancements back to spotify?
I quickly whipped up https://github.com/flaccid/docker-docker-gc-crond. Seemed an appropriate way instead of Rancher constantly scheduling a new container after it exits the docker-gc process
@flaccid no, i haven’t yet done any PR…it will come once i get the fingers on it again.
thanks for posting on the docker-docker-gc-crond, I was actually looking for something similar and was trying to use https://github.com/ActiveState/dockron but I it didn’t work for me. I’ll try your solution.