docker删除镜像时报错解决办法
- 报错信息
[root@kvm ~]# docker rmi 4950a54ede5a
Error response from daemon: conflict: unable to delete 4950a54ede5a (must be forced) - image is being used by stopped container 834789a17497
- 报错原因
image is being used by stopped container 834789a17497,即要删除的该镜像,被容器834789a17497所引用了。 - 解决办法
- 执行
docker ps -a
查看所有容器记录(包括未运行的容器),并查看那些容器是使用了这个要删除的镜像:
- 执行命令
docker rm container_ID
删除这两个容器
- 执行
[root@kvm ~]# docker rm 834789a17497
834789a17497
[root@kvm ~]# docker rm 63b699a2cbb6
63b699a2cbb6
* 执行命令`docker rmi image_ID`删除镜像
[root@kvm ~]# docker rmi 4950a54ede5a
Untagged: www.wholj.com:7.5
Deleted: sha256:4950a54ede5a5c0da704c6f74e6bcc43d440e83260b0752a926325035435a7dc
Deleted: sha256:788edba9eaa8ade63d8ba9d5747281c5da2b34b12a6c80f4dffd8ad9e05f68c1
by: wholj
email: wholj7650@163.com