Created
May 14, 2025 15:35
-
-
Save luizen/e3e723067e82941dfc31b597b52d569f to your computer and use it in GitHub Desktop.
A collection of utility scripts for Docker on Windows
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
Write-Output "-------------------" | |
Try | |
{ | |
Write-Output "--> Stopping all containers..." | |
docker stop $(docker ps -a -q) 2>&1 | out-null | |
Write-Output "--> Deleting all stopped containers..." | |
docker rm $(docker ps -a -q) 2>&1 | out-null | |
Write-Output "--> Deleting all images..." | |
docker rmi $(docker images -q) 2>&1 | out-null | |
Write-Output "-------------------" | |
Write-Output "Cleanup DONE" | |
Write-Output " " | |
Write-Output "Listing containers..." | |
docker container list --all 2>&1 | |
Write-Output " " | |
Write-Output "Listing images..." | |
docker image list --all 2>&1 | |
} | |
Catch | |
{ | |
Write-Output "Fatal error. Exiting..." | |
Exit 1 | |
} | |
Write-Output "-------------------" |
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
Write-Output "-------------------" | |
Try | |
{ | |
Write-Output "--> Containers..." | |
docker container list --all 2>&1 | |
Write-Output "--> Images..." | |
docker image list --all 2>&1 | |
} | |
Catch | |
{ | |
Write-Output "Fatal error. Exiting..." | |
Exit 1 | |
} | |
Write-Output "-------------------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment