Skip to content

Instantly share code, notes, and snippets.

@pubkey
Last active January 14, 2021 09:18
Show Gist options
  • Save pubkey/73dcb894cf5f7d262863 to your computer and use it in GitHub Desktop.
Save pubkey/73dcb894cf5f7d262863 to your computer and use it in GitHub Desktop.
Delete all Docker images and containers and volumes and networks
# stop and delete all containers
docker rm -f $(docker ps -a -q)
# delete all images
docker rmi -f $(docker images -q)
# delete all volumes
docker volume rm $(docker volume ls -q)
# remove all networks
docker network rm $(docker network ls -q)
## all together
docker rm -f $(docker ps -a -q) && docker rmi -f $(docker images -q) && docker volume rm $(docker volume ls -q) && docker network rm $(docker network ls -q)
# remove all docker-compose images (run this in the folder where your docker-compose.yml is)
docker-compose rm -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment