gpt4 book ai didi

docker - 由于错误 : "Error response from daemon: reference does not exist" 无法删除图像

转载 作者:行者123 更新时间:2023-12-04 15:31:46 31 4
gpt4 key购买 nike

我在尝试清除 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

  • 然后这个错误: No such image: 2f21ea981017:latest 出现,我应该问,为什么?这样的形象在哪里? 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 - 由于错误 : "Error response from daemon: reference does not exist" 无法删除图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39662746/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com