解决Error response from daemon: conflict: unable to delete 7597f617968f (must be forced) - image is be
在删除REPOSITORY为none的docker镜像时,报如下Error错误:[root@VM-0-16-centos ~]# docker images | grep none | awk '{print $3}' | xargs docker rmiError response from daemon: conflict: unable to delete 7597f617968f (mus
·
在删除REPOSITORY为none的docker镜像时,报如下Error错误:
[root@VM-0-16-centos ~]# docker images | grep none | awk '{print $3}' | xargs docker rmi
Error response from daemon: conflict: unable to delete 7597f617968f (must be forced) - image is being used by stopped container cfc1f6709c6a
原因是这个镜像已经作为容器启动运行过,需要先删除容器,再删除镜像。
使用docker ps -a查看所有的容器:
[root@VM-0-16-centos ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cd50469474fa nginx "/docker-entrypoint.…" 11 minutes ago Up 11 minutes 0.0.0.0:9001->80/tcp, :::9001->80/tcp musing_lovelace
a230d1c6d569 7597f617968f "/bin/sh -c 'pip ins…" 47 hours ago Exited (1) 47 hours ago naughty_chandrasekhar
cfc1f6709c6a 7597f617968f "/bin/sh -c 'pip ins…" 47 hours ago Exited (1) 47 hours ago reverent_tesla
删除container_id为cfc1f6709c6a和a230d1c6d569的容器
[root@VM-0-16-centos ~]# docker rm cfc1f6709c6a
cfc1f6709c6a
[root@VM-0-16-centos ~]# docker rm a230d1c6d569
a230d1c6d569
再删除镜像可成功删除:
[root@VM-0-16-centos ~]# docker images | grep none | awk '{print $3}' | xargs docker rmi
Deleted: sha256:7597f617968f1cd6c1bbd9750e6ad592d426a97f0c21c193b12b096cbbd9028c
Deleted: sha256:97248e1cc643aa2ef8a15ed69c8be93119c6de48dfc5b1e1fcaa1d08730f56dd
Deleted: sha256:a0d59b817e94bec945457b77bd8a92a6833f982f6af0e621f6c66225850b70f7
Deleted: sha256:feca55425f190f1f25e8782ba4799e1bf9170fe132066577208238d5f3958208
查看所有的镜像,发现REPOSITORY为none的镜像已经全部删除掉:
[root@VM-0-16-centos ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 62d49f9bab67 5 months ago 133MB
python 2.7-slim eeb27ee6b893 17 months ago 148MB
java 8 d23bdf5b1b1b 4 years ago 643MB
更多推荐
已为社区贡献1条内容
所有评论(0)