Can’t delete docker image with dependent child images

前端 未结 19 2119
挽巷
挽巷 2020-12-02 06:11

I am trying

docker rmi c565603bc87f

Error:

Error response from daemon: conflict: unable to delete c565603bc87f (ca

相关标签:
19条回答
  • 2020-12-02 06:46

    you can just do this:

    ➜ ~ sudo docker rmi 4ed13257bb55 -f Deleted: sha256:4ed13257bb5512b975b316ef482592482ca54018a7728ea1fc387e873a68c358 Deleted: sha256:4a478ca02e8d2336595dcbed9c4ce034cd15f01229733e7d93a83fbb3a9026d3 Deleted: sha256:96df41d1ce6065cf75d05873fb1f9ea9fed0ca86addcfcec7722200ed3484c69 Deleted: sha256:d95efe864c7096c38757b80fddad12819fffd68ac3cc73333ebffaa42385fded

    0 讨论(0)
  • 2020-12-02 06:47

    Suppose we have a Dockerfile

    FROM ubuntu:trusty
    CMD ping localhost
    

    We build image from that without TAG or naming

    docker build .
    

    Now we have a success report "Successfully built 57ca5ce94d04" If we see the docker images

    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    <none>              <none>              57ca5ce94d04        18 seconds ago      188MB
    ubuntu              trusty              8789038981bc        11 days ago         188MB
    

    We need to first remove the docker rmi 57ca5ce94d04

    Followed by

    docker rmi 8789038981bc
    

    By that image will be removed!

    A forced removal of all as suggested by someone

    docker rmi $(docker images -q) -f
    
    0 讨论(0)
  • 2020-12-02 06:49

    all previous answers are correct but here is one solution which is just deleteing all of your images forcefully (use this command at your own risk it will delete all of your images)

    docker rmi $(docker images -q) -f
    

    0 讨论(0)
  • 2020-12-02 06:49

    The answer here is to find all descendent children, which has an answer here:

    docker how can I get the list of dependent child images?

    Then use that to remove the child images in order.

    0 讨论(0)
  • 2020-12-02 06:55

    THIS COMMAND REMOVES ALL IMAGES (USE WITH CAUTION)

    Have you tried to use --force

    sudo docker rmi $(sudo docker images -aq) --force
    

    This above code run like a charm even doe i had the same issue

    0 讨论(0)
  • 2020-12-02 06:56

    You should try to remove unnecessary images before removing the image:

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

    After that, run:

    docker rmi c565603bc87f
    
    0 讨论(0)
提交回复
热议问题