For whatever its worth, don't run spotify/docker-gc

Just ran spotify/docker-gc and watched it delete every stopped container (sidekicks bye bye)… Just as a warning to everyone here.

@withinboredom that is why we forked it and implemented dry-run and exclusion of certain containers/images via environment variables

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

1 Like

Thanks @demarant did you try to pull request these enhancements back to spotify?

I quickly whipped up Seemed an appropriate way instead of Rancher constantly scheduling a new container after it exits the docker-gc process :slight_smile:

@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 but I it didn’t work for me. I’ll try your solution.

1 Like