moby: cannot delete docker images with no repository/tag
Accidentally created a lot of images by running docker build with the same repo/tag, and now I have all these images that can’t be deleted.
[k2 foo (dockerize)] $ uname -a
Linux k2 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[k2 foo (dockerize)] $ sudo docker -D info
Containers: 46
Images: 64
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Dirs: 156
Execution Driver: native-0.2
Kernel Version: 3.13.0-30-generic
Debug mode (server): false
Debug mode (client): true
Fds: 10
Goroutines: 9
EventsListeners: 0
Init Path: /usr/bin/docker
Sockets: [unix:///var/run/docker.sock]
WARNING: No swap limit support
[k2 foo (dockerize)] $ sudo docker version
Client version: 1.1.1
Client API version: 1.13
Go version (client): go1.2.1
Git commit (client): bd609d2
Server version: 1.1.1
Server API version: 1.13
Go version (server): go1.2.1
Git commit (server): bd609d2
A demonstration of the problem…
[k2 foo (dockerize)] $ sudo docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
tpt v1 ade46935b7ff 22 hours ago 655.7 MB
<none> <none> 8ffe63c7fe0c 22 hours ago 655.7 MB
<none> <none> 05713d75925a 23 hours ago 655.7 MB
<none> <none> e2204761e2d2 23 hours ago 655.7 MB
<none> <none> 9d9bb03c1b31 23 hours ago 655.7 MB
<none> <none> 0c085c5f4d90 23 hours ago 655.7 MB
<none> <none> ee0efbd04005 23 hours ago 547 MB
<none> <none> 61dcf760957b 23 hours ago 300.3 MB
<none> <none> 21abc21cba16 23 hours ago 300.3 MB
<none> <none> 5cff31633fd1 23 hours ago 276.5 MB
<none> <none> 919267d9932f 24 hours ago 276.5 MB
<none> <none> 97793a6d1adf 24 hours ago 276.5 MB
<none> <none> fab5a70dd326 25 hours ago 276.5 MB
<none> <none> 68798be9802c 25 hours ago 276.5 MB
<none> <none> 052b05ba5e5b 25 hours ago 276.5 MB
<none> <none> 2870051ec7a2 25 hours ago 276.5 MB
<none> <none> 80f080076b4c 25 hours ago 276.5 MB
<none> <none> 65dc8f9c17a3 25 hours ago 276.5 MB
<none> <none> f87646bfcbd7 25 hours ago 276.5 MB
<none> <none> efcc51f5de92 25 hours ago 276.5 MB
<none> <none> ffaf74c67db8 25 hours ago 276.5 MB
<none> <none> d6aaa3c3f8a0 25 hours ago 276.5 MB
<none> <none> 6821b7eee77f 25 hours ago 276.5 MB
<none> <none> e24ed4424008 25 hours ago 276.5 MB
<none> <none> b0a59c722ed6 25 hours ago 276.5 MB
ubuntu 14.04 e54ca5efa2e9 3 weeks ago 276.5 MB
training/webapp latest 31fa814ba25a 7 weeks ago 278.8 MB
[k2 foo (dockerize)] $ sudo docker rmi 8ffe63c7fe0c
Error response from daemon: Conflict, cannot delete 8ffe63c7fe0c because the container 30fc441dc06b is using it, use -f to force
2014/07/16 13:16:52 Error: failed to remove one or more images
[k2 foo (dockerize)] $ sudo docker rmi 30fc441dc06b
Error response from daemon: No such image: 30fc441dc06b
2014/07/16 13:17:00 Error: failed to remove one or more images
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 20 (3 by maintainers)
workaround
using
-f
argument, it works for meBTW, if you want to remove all your docker images you can pass the output of
docker ps -aq
todocker rm
like this:There’s no need to use the above
xargs
cmd. That’s just overkill here.@shoenig 30fc441dc06b is a container not an image, try
docker rm 30fc441dc06b
try with-f
it doesn’t work.@shoenig
docker ps
will list the running containers anddocker ps -a
will list even the stopped ones. I highly recommend you read http://docs.docker.com/userguide/usingdocker/ as well as other user guides.You can begin by : docker kill $(docker ps -q)
And if delete is not working try with (-f):
IMAGES: docker rmi -f $(docker images -aq) => for all images (with forcing (-f)) docker rmi -f <id/sha image> => for one image (with forcing (-f))
CONTAINER: docker rm -f $(docker ps -aq) => for all containers (with forcing (-f)) docker rm -f <id/sha contenair> => for one contenair (with forcing (-f))
VOLUMES: docker volume rm $(docker volume ls -qf dangling=true) => for all volumes
If you staged the commits in docker, docker rm/rmi/rm -f won’t work. Use the below command to un stage the commits and remove docker image. $ sudo docker images | grep “<none>” | awk ‘{print $3}’ | xargs sudo docker rmi imagename:tagname
Even i faced the same problem and i fixed it as shown below
first remove all the containers using the following sudo docker ps -a -q | xargs -n 1 -I {} sudo docker rm {}
Now you can remove the image that you want using sudo docker rmi 8ffe63c7fe0c