imh*_*ngh 3 containers image docker
我尝试使用以下命令创建一个容器
docker run -it centos bash
Run Code Online (Sandbox Code Playgroud)
并退出而没有杀死它。
现在我尝试使用 CentOS 映像的映像 ID 来删除它。
docker rmi -f 0f3e07c0138f
Error response from daemon: conflict: unable to delete 0f3e07c0138f (cannot be forced) - image is being used by running container a9eab034a426
Run Code Online (Sandbox Code Playgroud)
在 docker 文档页面上,它说“除非使用 -f 选项,否则无法删除正在运行的容器的映像。” 但我仍然无法使用 -f 删除图像。对此有何解释?文档中是否应该进行更正?
a9eab034a426容器正在使用centos图像。因此,要删除centos,您需要停止并删除a9eab034a426容器。运行以下几行。
docker stop a9eab034a426
docker rm a9eab034a426
docker rmi 0f3e07c0138f
Run Code Online (Sandbox Code Playgroud)