I'm running docker via CoreOS and AWS's ECS. I had a failing image that got restarted many times, and the containers are still around- they filled my drive partition. Specifically, /var/lib/docker/overlay/
contains a large number of files/directories.
I know that docker-cleanup-volumes is a thing, but it cleans the /volumes directory, not the /overlay directory.
docker ps -a
shows over 250 start attempts on my bad docker container. They aren't running, though.
Aside from rm -rf /var/lib/docker/overlay/*
, how can I/should I clean this up?
Docker garbage collection can be done in an easy way using another docker container https://github.com/spotify/docker-gc
You could make it run as a cron using https://github.com/flaccid/docker-docker-gc-crond
Here is a working option:
BE CAREFUL, this solutions seems remove other important stuffs.
You need inspect your images/containers and remove the folders in /opt/docker/overlay that wasn't found in inspect's execution