解决Docker 删除镜像报错“Error response from daemon: conflict”

报错内容:

Error response from daemon: conflict: unable to delete f5b6ef70d79b (must be forced) - image is being used by stopped container 0a740a8a885c
解决办法:

先删除容器,再删除镜像

删除所有已停止的容器 docker rm $(docker ps -a -q)
删除所有镜像 docker rmi $(docker images -q)
强制删除

强制删除所有镜像 docker rmi -f $(docker images -q)