Mercurial > hg > config
annotate bin/docker_vacuum.sh @ 866:909f72bd6cb3
remove stopped containers
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 18 Jul 2018 09:29:20 -0700 |
parents | e300310bb98c |
children | 002c1e85ff30 |
rev | line source |
---|---|
794 | 1 #!/bin/bash |
2 | |
3 # http://blog.yohanliyanage.com/2015/05/docker-clean-up-after-yourself/ | |
4 | |
866 | 5 # Remove all stopped containers |
6 docker container prune -f | |
7 | |
794 | 8 # Make sure exited containers are deleted |
9 docker rm -v $(docker ps -a -q -f status=exited) | |
10 | |
11 # Remove unwanted 'dangling' images | |
12 docker rmi $(docker images -f "dangling=true" -q) | |
13 | |
14 # Remove unwanted volumes | |
15 docker volume rm $(docker volume ls -qf dangling=true) |