无法清理<无>存储库

时间:2016-05-17 02:28:26

标签: docker

我尝试使用命令

清理这些存储库

sudo docker rmi -f $(docker images -a | grep "<none>" | awk "{print \$3}"

它应该由-f选项工作但是给了我

Error response from daemon: Conflict, 58dc8b35c567 wasn't deleted
Error response from daemon: Conflict, 1ca48c1cbec5 wasn't deleted
Error response from daemon: Conflict, 0f8b62ff7034 wasn't deleted
.
.(about 30 lines)
.
Error response from daemon: Conflict, 1ffad67b1f13 wasn't deleted
Error response from daemon: Conflict, ef2704e74ecc wasn't deleted
FATA[0001] Error: failed to remove one or more images

同样的问题,即使我尝试删除单张图片

命令:sudo docker rmi -f ef2704e74ecc

响应: Error response from daemon: Conflict, ef2704e74ecc wasn't deleted FATA[0000] Error: failed to remove one or more images

1 个答案:

答案 0 :(得分:1)

docker 1.7-1.9存在类似问题:issue 12487

它可以链接to a bad container(在docker 1.8中修复)

如评论为issue 11154,请先尝试清理悬空图像:

  

签出sshd_config删除任何“悬空”的图像(任何父图像都没有使用)

如果它没有链接到容器,那么唯一的“解决方法”就是核对所有内容并重启docker。

docker rmi $(docker images -q --filter dangling=true)

当然,这是最后的解决方法,请确保您没有任何首先需要保存/备份的本地数据(尤其是$ rm -rf /var/lib/docker $ systemctl restart docker )。