Skip to content

Instantly share code, notes, and snippets.

@jaircuevajunior
Forked from beeman/remove-all-from-docker.sh
Last active April 7, 2020 17:21
Show Gist options
  • Save jaircuevajunior/d732d66779f41cc6d4abe65d6d44b7a2 to your computer and use it in GitHub Desktop.
Save jaircuevajunior/d732d66779f41cc6d4abe65d6d44b7a2 to your computer and use it in GitHub Desktop.
Remove all from Docker
# MY FORK
sudo docker system prune -a --volumes -f
# ORIGINAL =============================
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
docker volume rm $(docker volume ls -qf)
# Remove all networks
docker network rm `docker network ls -q`
# Your installation should now be all fresh and clean.
# The following commands should not output any items:
# docker ps -a
# docker images -a
# docker volume ls
# The following command show only show the default networks:
# docker network ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment