Docker Community Forums

Share and learn in the Docker community.

Unable to delete a docker image

docker

(Bluemind2005) #1

Good Folks,

Can you help me to understand why I am unable to delete docker image?

[jim@docker1 nagios-docker]$ docker rmi -f $(docker images|awk ‘{print $1}’|sed “1 d”)
Error response from daemon: No such image: centos:latest
Error response from daemon: No such image: centos:latest
[jim@docker1 nagios-docker]$ docker images|awk ‘{print $1}’|sed "1 d"
centos
centos
[jim@docker1 nagios-docker]$ docker images|awk '{print $1}'
REPOSITORY
centos
centos
[jim@docker1 nagios-docker]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 50dae1ee8677 4 weeks ago 196.7 MB
centos centos6 cf2c3ece5e41 7 weeks ago 194.6 MB
[jim@docker1 nagios-docker]$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[jim@docker1 nagios-docker]$

Pretty obvious command which should work, not sure what is the issue?


(Leo Chen) #2

Have you ever tried this?

docker rmi `docker images -q`

if it doesn’t work , try restart docker service


(Bluemind2005) #3

Still doesn’t work for some reason even after restarting docker service.

[jim@docker1 ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              latest              50dae1ee8677        4 weeks ago         196.7 MB
centos              centos6             cf2c3ece5e41        7 weeks ago         194.6 MB
[jim@docker1 ~]$ sudo systemctl restart docker.service
[sudo] password for jim: 
[jim@docker1 ~]$ docker rmi `docker images -q`
Error response from daemon: reference does not exist
Error response from daemon: reference does not exist
[jim@docker1 ~]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              latest              50dae1ee8677        4 weeks ago         196.7 MB
centos              centos6             cf2c3ece5e41        7 weeks ago         194.6 MB
[jim@docker1 ~]$ docker rmi 50
Error response from daemon: reference does not exist
[jim@docker1 ~]$ docker rmi c
Error response from daemon: reference does not exist
[jim@docker1 ~]$

(Bluemind2005) #4

Any idea/update from Experienced Docker Guru ?


(Denys Slipetskyy) #5

Did you manage to do it ?
Overwise try to filter out possibly dangling images: docker rmi $(docker images -qa -f dangling=true)


(Nathan Le Claire) #6

Looks like a bug.

What’s the storage driver? Docker version?

consider filing an issue report at https://github.com/docker/docker/issues/new with some steps to reproduce if possible.