Last active
October 5, 2023 15:40
-
-
Save labboy0276/4406db072f9ed3bf3641f57c1d902027 to your computer and use it in GitHub Desktop.
Purge all Docker Containers & Lando Cache
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
#!/bin/bash | |
echo 'Stopping Containers' | |
# Stop all containers | |
containers=`docker ps -a -q` | |
if [ -n "$containers" ] ; then | |
docker stop $containers | |
fi | |
echo 'Deleting Containers' | |
# Delete all containers | |
containers=`docker ps -a -q` | |
if [ -n "$containers" ]; then | |
docker rm -f -v $containers | |
fi | |
echo 'Deleting Images' | |
# Delete all images | |
images=`docker images -q -a` | |
if [ -n "$images" ]; then | |
docker rmi -f $images | |
fi | |
echo 'Pruning Network' | |
docker network prune -f | |
echo 'Purging Lando Cache' | |
rm -rf ~/.lando/cache |
Thanks for sharing @generalredneck, that does the job perfectly, and everything gets cleaned up nicely.
I was just about to suggest adding it to the documentation, but when I looked, I see you beat me to it @labboy0276 :)
https://docs.lando.dev/help/purging-containers.html
PS. "behvaior"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fancy