docker rmi cannot remove images, with: no such id

前端 未结 9 1327
感情败类
感情败类 2021-01-30 12:52

I have a lot of images. When I try to remove them with docker rmi

$ sudo docker rmi acd33a9490dc
Error response from daemon: No such id: 75ce1f6710b         


        
相关标签:
9条回答
  • 2021-01-30 13:18

    So... some cases of this seem to be because you have a no-longer-running container that references the image. Removing the container allows you to then remove the image.

    But there is definitely a bug where docker gets itself into a state where no matter what you do, it can't remove any image. This has been fixed in docker 1.4.0: https://github.com/docker/docker/commit/ac40e7c

    0 讨论(0)
  • 2021-01-30 13:22

    this will remove all your container and then you can remove the images

    sudo docker ps -a | awk '{print $1}' | grep -v CONTAINER | xargs sudo docker rm {}\;

    0 讨论(0)
  • 2021-01-30 13:23

    First you need to locate the container holding the image.

    To remove a single container with the image

    docker ps -a
    

    You will get such an output

    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    g7aea2132441        2285ff53ab18        "/bin/bash"         2 days ago                                                  tombrider 
    

    Then remove the container using

    docker rm g7aea2132441
    

    To remove all the containers and images do

    1. Remove all the containers

      docker stop $(docker ps -a -q)
      docker rm $(docker ps -a -q)
      
    2. Remove the now dangling images

      docker images -q --filter "dangling=true" | sudo xargs docker rmi
      
    0 讨论(0)
提交回复
热议问题