docker 技巧 Sep 5, 2016 1. 删除 none tag 镜像2. 删除所有镜像3. 删除所有容器4. 删除所有停止运行的容器5. 删除所有 dangling (unused) 的镜像6. xargs with –no-run-if-empty is even better as it does cleanly handle the case when there is nothing to be removed. 删除 none tag 镜像1docker rmi $(docker images | grep "^<none>" | awk '{print $3}') 1docker rmi $(docker images -q --filter "dangling=true") 删除所有镜像1docker images -q | xargs docker rmi 删除所有容器1docker ps -q -a | xargs docker rm 删除所有停止运行的容器1docker rm $( docker ps -q -f status=exited) 删除所有 dangling (unused) 的镜像1docker rmi $( docker images -q -f dangling=true) xargs with –no-run-if-empty is even better as it does cleanly handle the case when there is nothing to be removed.1234# Delete all stopped containersdocker ps -q -f status=exited | xargs --no-run-if-empty docker rm# Delete all dangling (unused) imagesdocker images -q -f dangling=true | xargs --no-run-if-empty docker rmi