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: 75ce1f6710bab109a7d7cbee056fa8a0c7fa913e81c88e2a55121149dda80ee9
2014/07/14 10:13:24 Error: failed to remove one or more images
That 75ce1... hash is the same no matter which docker image I try to remove.
At present, the below gives the current docker version; however some of these images have been around since an earlier version (0.6 or so)
$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a
If you need to remove several images, then you can delete all containers with
Now you can remove any images.
I think this is the expected behavior, not a bug. This is because you have containers hanging around that have not been deleted. These containers are instances of the image, and that is preventing you from dropping that image.
Step 1 - remove unused container instances
Both jripoll's answer and Andras Hatvani's answer show ways of listing and removing the containers that are bound to the images.
Note that the latter will delete all container instances!! So, if there is one that you need to commit as a new image, you should do that first.
Step 2 - remove unnecessary images
After the containers have been deleted, you will be able to remove any images they were based on.
To quickly remove any untagged containers (ones that show up as
<none> <none>
when you runsudo docker images
) you can run the following command:I have saved that in
/usr/local/bin/docker-purge-dangling
so I can run it without needing to remember the command.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
Sincere appreciation to all of you. I have tried all your approaches, but was not able to delete the following image:
I had to remove it from here instead:
Now it is gone.
Put in your terminal:
You can see your IMAGEID in the column IMAGE. Get the CONTAINER ID an remove the container:
And now you can remove the image:
First you need to locate the container holding the image.
To remove a single container with the image
You will get such an output
Then remove the container using
To remove all the containers and images do
Remove all the containers
Remove the now dangling images