Created
September 29, 2020 12:30
-
-
Save rfuehrer/8ee46f6e9131d4fe388c4889bf91f430 to your computer and use it in GitHub Desktop.
Bash script to reset/delete all docker components (images, container, volumes, networks)
This file contains 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
# 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 -q) | |
#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: | |
echo "" | |
echo "#############################################" | |
echo "##### Docker Container" | |
echo "#############################################" | |
docker ps -a | |
echo "" | |
echo "#############################################" | |
echo "##### Docker Images" | |
echo "#############################################" | |
docker images -a | |
echo "" | |
echo "#############################################" | |
echo "##### Docker Volumes" | |
echo "#############################################" | |
docker volume ls | |
# The following command show only show the default networks: | |
echo "" | |
echo "#############################################" | |
echo "##### Docker default ntworks" | |
echo "#############################################" | |
docker network ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment