Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "conflict: unable to remove repository reference"

Tags:

docker

I am trying to delete a test image:

docker image rm test-image

but I'm getting

Error response from daemon: conflict: unable to remove repository reference "test-image" (must force) - container 4ca6d09c1103 is using its referenced image 133c9587889f

However, this container does not exist:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
fff756b1399a        rocker/shiny        "/usr/bin/shiny-se..."   6 months ago        Up 12 days          0.0.0.0:3838->3838/tcp   shinyServerBdl2

So: What is this about?

I've called

docker build . -t test-image
docker run -it test-image

to create the image from a Dockerfile but why can't I delete the image here? I also tried

docker rmi test-image

without success.

like image 676
Stefan Falk Avatar asked Feb 21 '18 15:02

Stefan Falk


People also ask

How do I delete a failed docker container?

Use the docker container prune command to remove all stopped containers, or refer to the docker system prune command to remove unused containers in addition to other Docker resources, such as (unused) images and networks.

How do I stop all docker containers?

It created the three containers, and you can see them running with docker ps -a. Stopping them is just as easy. Simply run docker-compose down in the same directory.

How do you prune docker?

The docker system prune command is a shortcut that prunes images, containers, and networks. Volumes are not pruned by default, and you must specify the --volumes flag for docker system prune to prune volumes. By default, you are prompted to continue. To bypass the prompt, use the -f or --force flag.


1 Answers

Make sure that a container does not exist that is using the image. The container can be stopped and thus won't show when you run docker ps. You can do docker ps --all to view all runninn and stopped container. In short, running the following should remove the image:

docker container rm 4ca6d09c1103
docker image rm test-image
like image 111
yamenk Avatar answered Nov 16 '22 01:11

yamenk