Created
August 22, 2019 15:28
-
-
Save Joshfindit/24d41b54ec6529c71f78bb0effc71246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Exit `docker-compose run` containers | |
docker rm $(docker ps -a -f "name=_run_" -q) | |
#Make sure that exited containers are deleted. | |
docker rm -v $(docker ps -a -q -f status=exited) | |
#Remove unwanted ‘dangling’ images | |
docker rmi $(docker images -f "dangling=true" -q) | |
#Remove unused networks | |
docker network rm $(docker network ls | grep "bridge" | awk '/ / { print $1 }') | |
#Delete unwanted volumes (vfs) | |
docker volume rm $(docker volume ls -qf dangling=true) | |
## Extra tool as of docker 1.7.something | |
# docker system prune -a ## Be aware, this will delete images that currently-running containers are based on (ruby:latest, for example) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment