Skip to content

Instantly share code, notes, and snippets.

@Shogan
Last active November 7, 2018 16:10
Show Gist options
  • Save Shogan/9a0bf97ea15db67cf0a6e088002e290a to your computer and use it in GitHub Desktop.
Save Shogan/9a0bf97ea15db67cf0a6e088002e290a to your computer and use it in GitHub Desktop.
Powershell Docker commands and useful one-liners
# Get list of all untagged images with no repository set
docker images --format "{{.ID}}--{{.Repository}}--{{.Tag}}" | Where { $_ -match "<none>--<none>" } | % { $_.Split("--")[0] }
# Remove all untagged / no repository docker images
docker images --format "{{.ID}}--{{.Repository}}--{{.Tag}}" | Where { $_ -match "<none>--<none>" } | % { $_.Split("--")[0] } | % { docker rmi $_ }
# Remove all stopped containers
docker ps -a -q | % { docker rm $_ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment