Created
May 3, 2019 20:43
-
-
Save hatemzidi/93e31fbf827c326071810ca1f5ee21e2 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
# Remove all stopped containers | |
# Remove all volumes not used by at least one container | |
# Remove all networks not used by at least one container | |
# Remove all dangling images | |
# https://docs.docker.com/engine/reference/commandline/system_prune/#usage | |
docker system prune | |
# Remove leftover containers | |
docker ps -a -f status=exited -q | xargs -r docker rm | |
# Remove leftover images | |
docker images --no-trunc -q -f dangling=true | xargs -r docker rmi | |
# Remove dangling volumes | |
docker volume ls -qf dangling=true | xargs -r docker volume rm | |
#List all containers (only IDs) | |
docker ps -aq | |
#Stop all running containers | |
docker stop $(docker ps -aq) | |
#Remove all containers | |
docker rm $(docker ps -aq) | |
#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