The docker system prune command removes all stopped containers, dangling images, and unused networks and if we pass the
--volumes
option we can remove all unused volumes too.docker system prune docker system prune --volumes
You can execute the below commands in PowerShell to remove all the images and docker containers.
Remove all containers:
docker ps -a -q | % { docker rm $_ }
Remove all images:
docker images -q | % { docker rmi $_ }
Remove all the version of the image if the image name contains given text:
docker images --format='{{json .}}'|Select-String -Pattern "${imageName}" | ConvertFrom-Json | ForEach-Object -process { docker rmi -f $_.ID}