Open shekhargulati opened 8 years ago
When you are building all kinds of docker images, you may end up with a lot of untagged images, volumes. A trick I used in my own projects is a bash function like this.
# docker clean up, remove all stopped containers and untagged images
# http://jimhoskins.com/2013/07/27/remove-untagged-docker-images.html
# https://github.com/chadoe/docker-cleanup-volumes
# https://www.calazan.com/docker-cleanup-commands/
docker-cleanup() {
docker rm $(docker ps -a -q);
docker rmi $(docker images -q -f dangling=true);
docker volume rm $(docker volume ls -qf dangling=true)
}
Most of the times, just removing the stopped containers is good enough. But it's nice to have something to clean up locally.
@soleo thanks. I have added it to the blog.
Please provide your feedback by posting a comment against this issue.