Last active
July 24, 2023 22:45
-
-
Save nickistre/5ed2ee4826f55c2ecdca20561aef0c77 to your computer and use it in GitHub Desktop.
Reset Docker environment
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
#!/usr/bin/env bash | |
# All in one line | |
docker stop $(docker ps -q) ; docker rm $(docker ps -aq) ; docker rmi -f $(docker images -q) ; docker volume prune -f ; docker network prune -f ; docker system prune -a --volumes -f |
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
#!/usr/bin/env bash | |
# To quickly reset a docker environment | |
# Stop currently running docker containers | |
docker stop $(docker ps -q) | |
# Remove all docker containers | |
docker rm $(docker ps -aq) | |
# Force remove all docker images | |
docker rmi -f $(docker images -q) | |
# Remove unused volumes | |
docker volume prune -f | |
# Remove unused networks | |
docker network prune -f | |
# Final run to remove all unused images and volumes | |
docker system prune -a --volumes -f |
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
#!/usr/bin/env bash | |
# All in one line | |
docker stop $(docker ps -q) ; docker rm $(docker ps -aq) ; docker volume prune -f ; docker network prune -f |
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
#!/usr/bin/env bash | |
# To quickly reset a docker environment | |
# Stop currently running docker containers | |
docker stop $(docker ps -q) | |
# Remove all docker containers | |
docker rm $(docker ps -aq) | |
# Remove unused volumes | |
docker volume prune -f | |
# Remove unused networks | |
docker network prune -f |
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
#!/usr/bin/env bash | |
# To quickly stop all running containers | |
# Stop currently running docker containers | |
docker stop $(docker ps -q) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@NorseGaud Thanks! Added it to my
docker-reset-full
scripts.