Skip to content

Instantly share code, notes, and snippets.

@tonym128
Forked from alferov/docker-rm-images.md
Last active October 11, 2018 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tonym128/f045f039d147a636a2a78969652ce144 to your computer and use it in GitHub Desktop.
Save tonym128/f045f039d147a636a2a78969652ce144 to your computer and use it in GitHub Desktop.
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")

# System Prune
# WARNING! This will remove:
#        - all stopped containers
#        - all networks not used by at least one container
#        - all dangling images
#        - all build cache
docker system prune

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment