更新时间:2022-11-05 15:49:38
对于Unix
删除所有容器,包括
docker rm -vf $(docker ps -a -q)
要删除所有图像,
docker rmi -f $(docker images -a -q)
请记住,您应先删除所有容器,然后再删除创建这些容器所用的所有图像。
Remember, you should remove all the containers before removing all the images from which those containers were created.
对于Windows
如果您使用的是Windows(Powershell),
In case you are working on Windows (Powershell),
$images = docker images -a -q
foreach ($image in $images) { docker image rm $image -f }
基于CodeSix的评论,WindowS Powershell的一个衬里,
Based on the comment from CodeSix, one liner for Window's Powershell,
docker images -a -q | % { docker image rm $_ -f }