Last active
April 25, 2018 11:38
-
-
Save kamilziajka/e90e5dc6e3e2af254eeddd5407323295 to your computer and use it in GitHub Desktop.
docker remove
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
# Remove all stopped containers | |
docker rm $(docker ps -a | grep "Exited" | cut -d " " -f1) | |
# Remove all images | |
docker rmi $(docker images | tail -n +2 | awk '{ print $3; }') | |
# Stop all containers except docker-registry | |
docker stop $(docker ps -a | grep -v "docker-registry" | tail -n +2 | cut -d " " -f1) | |
# Remove all containers except docker-registry | |
docker rm $(docker ps -a | grep -v "docker-registry" | tail -n +2 | cut -d " " -f1) | |
# Remove all images except registry | |
docker rmi $(docker images -a | grep -v "registry" | tail -n +2 | tr -s ' ' | cut -d " " -f3) | |
# Remove all containers | |
docker rm $(docker ps -a -q) | |
# Remove all images | |
docker rmi $(docker images -q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment