Remove Untagged Images From Docker for Windows

Here’s a quick note for Docker for Windows users. This is based on Jim Hoskin’s post Remove Untagged Images From Docker.

I’ve simply reformatted his two scripts for use on Docker for Windows via Powershell. To delete all stopped containers:

docker ps -a -q | % { docker rm $_ }

To delete all untagged local images:

docker images | ConvertFrom-String | where {$_.P2 -eq "<none>"} | % { docker rmi $_.P3 }