Created
June 13, 2018 10:36
-
-
Save ppartarr/ed358eca189af67e57d40b54dbe7fcbf to your computer and use it in GitHub Desktop.
♻️ Bash script to purge all containers, images, and volumes from docker
This file contains hidden or 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
#!/bin/bash | |
# Stop all running containers | |
docker stop $(docker ps -q) | |
# Remove all docker containers | |
docker rm $(docker ps -aq) | |
# Remove all images | |
docker rmi $(docker images -q) | |
# Remove all volumes | |
docker volume rm $(docker volume ls -q) | |
# Print container, images, and volumes to check that they are all empty | |
docker ps -a && docker image list && docker volume list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
example of a windows cmd equivalent using
for
loops: