docker – 由于错误而无法删除图像:“来自守护程序的错误响应:引用不存在”

前端之家收集整理的这篇文章主要介绍了docker – 由于错误而无法删除图像:“来自守护程序的错误响应:引用不存在”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在尝试清除Docker创建的图像时遇到了一个奇怪的问题.这就是我做的:

>删除所有容器

$docker rm $(docker ps -a -q)
bb3927e956bf
3e2eeb6287c4

>检查是否有任何容器在运行或创建后:

$docker ps -a
CONTAINER ID    IMAGE    COMMAND    CREATED    STATUS    PORTS    NAMES

>删除所有图像:第一次尝试失败,因为图像被引用

$docker rmi $(docker images -q)
Error response from daemon: conflict: unable to delete 2f21ea981017 (must be forced) - image is referenced in one or more repositories
Error response from daemon: conflict: unable to delete 2f21ea981017 (must be forced) - image is referenced in one or more repositories

>使用-f选项删除所有图像:

$docker rmi -f $(docker images -q)
Untagged: dev-PHP55:latest
Untagged: reynierpm/dev-PHP55:latest
Deleted: sha256:2f21ea981017f65adcf0df3764756690adc35d80538bbb6dcada12990f589f37
Deleted: sha256:7fbddc1aa50dca9bdf4f8c8033d20eca26ac00432f57333987c0eac3fe55fb08
Deleted: sha256:15883aeb774feafa64328ea2e77ebbe17a91e79ca1cd8bb2eebca60802fb01f5
Deleted: sha256:36ff96a995807763e302657eaeb671c000e58e3128a47f63bae543ba501387ed
Deleted: sha256:053f436f01f809f60ecba9fb961dfb6404dce163f84fbd905eb47a6b436ba50d
Deleted: sha256:b4525a37a105a199b7e7772de9e6ad86af645509c94c705bd13fbd422bf8f55d
Deleted: sha256:228092e34fffbb9def7f883eceea9f37fce3750d7a7d5a7551ce009410567240
Deleted: sha256:a17ed03e91cc4bef074258f731bba0945bcacc78c7ac9f00d88ca111125c94c0
Deleted: sha256:6118ff18e2049d3e13a903c4163e4e4aceea9fdd30555bdd71a1e23e8d5aa022
Deleted: sha256:b7347848822645efd3259a6c200a94c7bba15fc72b504c704e39f5db0cdca1a2
Deleted: sha256:b23b831be841f1f3cececec3e52480723d8312b464d9a89957e867fa695a4eca
Deleted: sha256:86c4c6d54d9dee52f8abe0ba8b3622b985bce68923dada61838b45860f000f44
Deleted: sha256:f053241f28e7c62ac77b44ee2f69a7bd6d2bb2ccdd9f916e43b8af88f5865f90
Deleted: sha256:3f36e15d9aac3c197472d66904fc59bd509ca36c8aa885165aadc6507f27126c
Deleted: sha256:6586309b23369f2ccb067ca456ebacd1602787960215d7c2e898c28ae6a2e78d
Deleted: sha256:43d7779d3bcd75a466df309735762f33552c2caf8f656ce1e26e1fd6b0324c49
Deleted: sha256:9e060bbbad0c042fc45eb52d3e4c41bfd30fb620459f10c62cf7e483d514e1d8
Deleted: sha256:9da9f4caedc27c128dc51d273f9d1411d6fce3f560c606fff0567d912d2d95e4
Error response from daemon: No such image: 2f21ea981017:latest
Error response from daemon: reference does not exist

然后这个错误:没有这样的形象:2f21ea981017:最新出现,我应该问,为什么?这样的形象在哪里? Docker有哪种内部数据库存储信息?

运行所有以前的命令后,我运行以下命令并注意输出

$docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              14.04.5             b1719e1db756        3 days ago          187.9 MB

但后来我尝试通过运行再次删除图像

$docker rmi b1719e1db756
Error response from daemon: reference does not exist

我得到了同样的错误,我在这里错过了什么?我怎么解决这个问题?

我应该补充说,我还运行了this post的命令,但没有成功.

最佳答案
我在docker-ce 17.06 / fedora 26上遇到过这个问题.我认为您不需要删除docker,但这些命令会删除所有图像.因此请保存您真正需要的任何图像,删除所有图像并恢复备份;

sudo systemctl stop docker.service
sudo rm -rf /var/lib/docker
sudo systemctl start docker.service

猜你在找的Docker相关文章