[fix] Error response from daemon: conflict unable to remove repository reference ubuntu container is using its referenced image


Docker rmi command Error:
Error response from daemon: conflict: 
unable to remove repository reference "ubuntu" (must force) - 
container c880076398dc is using its referenced image 8847e9bf6df8

If you try to remove a docker image using docker rmi command and you get the above error, because, either there is a container with this docker image still running, or it is in EXITED state.

Fix:

You will need to stop and remove the container that you created from the image before you can remove the image.

Run the docker ps -a command to see the containers,

% docker ps -a
CONTAINER ID   IMAGE     COMMAND       CREATED          STATUS          PORTS     NAMES
c880076398dc   fedora    "/bin/bash"   54 minutes ago   Up 54 minutes             brave_archimedes

Now first stop the container that is still referenced, c880076398dc in my case.

% docker stop c880076398dc
c880076398dc 

Now first remove the container that is still referenced, c880076398dc in my case.

% docker rm c880076398dc  
c880076398dc

Now you should be able to remove the image,

% docker rmi ubuntu

Untagged: ubuntu:latest
Untagged: ubuntu@sha256:cbf627299e327f564233aac6b97030f9023ca41d3453c497be2f5e8f7762d185
Deleted: sha256:8847e9bf6df80d7720e7daa5788671263f03a108a19cff8ff8c6f5f17fcad348
Deleted: sha256:e70c785847f52e4401c2cb812a809feaeee7c55d385dbb575db82288c7d41f76
Docker remove Image using Command Line

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap