Skip to content

Instantly share code, notes, and snippets.

@luizen
Created May 14, 2025 15:35
Show Gist options
  • Save luizen/e3e723067e82941dfc31b597b52d569f to your computer and use it in GitHub Desktop.
Save luizen/e3e723067e82941dfc31b597b52d569f to your computer and use it in GitHub Desktop.
A collection of utility scripts for Docker on Windows
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 "-------------------"
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