Skip to content

Instantly share code, notes, and snippets.

@IngussNeilands
Last active November 3, 2017 11:07
Show Gist options
  • Save IngussNeilands/59e515cd689ae1c5179edcf3df7c1cab to your computer and use it in GitHub Desktop.
Save IngussNeilands/59e515cd689ae1c5179edcf3df7c1cab to your computer and use it in GitHub Desktop.
Docker: Remove all images and containers
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
As of 1.13.0, see the new prune commands:
docker container prune # Remove all stopped containers
docker volume prune # Remove all unused volumes
docker image prune # Remove unused images
docker system prune # All of the above, in this order: containers, volumes, images
Bonus:
docker system df # Show docker disk usage, including space reclaimable by pruning
New Data Management commands PR: docker/docker#26108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment