[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.


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
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

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

% docker rm 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

Have Questions? Post them here!
Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.