Home > Software design >  docker rmi <hash> gives Error: No such image:
docker rmi <hash> gives Error: No such image:

Time:04-06

I believe I have tried every command recommended to remove the last few images from my sever, but I can't get rid of them.

I'm considering uninstalling docker and then remove /var/lib/docker and finally reinstalling docker. Would that work?

Here's what I've been trying.

[root@s-app-t54 docker]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@jenkins-agent-1 docker]# docker -v
Docker version 20.10.13, build a224086
[root@s-app-t54 docker]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@jenkins-agent-1 docker]# docker images
REPOSITORY                     TAG                                      IMAGE ID       CREATED         SIZE
redis                          6.0.10                                   621ceef7494a   14 months ago   104MB
tomcat                         8.5                                      37bdd9cb0d0e   14 months ago   533MB
adoptopenjdk/openjdk8-openj9   jdk8u275-b01_openj9-0.23.0-alpine-slim   440045c41637   15 months ago   142MB
busybox                        latest                                   dc3bacd8b5ea   16 months ago   1.23MB
redis                          6                                        62f1d3402b78   17 months ago   104MB
httpd                          latest                                   3dd970e6b110   18 months ago   138MB
redis                          5                                        f60d84d4d72c   20 months ago   98.3MB
stilliard/pure-ftpd            latest                                   07037e0784e0   23 months ago   169MB
redis                          latest                                   de25a81a5a0b   2 years ago     98.2MB
[root@jenkins-agent-1 docker]# docker volume ls
DRIVER    VOLUME NAME
[root@jenkins-agent-1 docker]# docker rmi -f 621ceef7494a 37bdd9cb0d0e 440045c41637 \
 dc3bacd8b5ea 62f1d3402b78 3dd970e6b110 f60d84d4d72c 07037e0784e0 de25a81a5a0b
Error: No such image: 621ceef7494a
Error: No such image: 37bdd9cb0d0e
Error: No such image: 440045c41637
Error: No such image: dc3bacd8b5ea
Error: No such image: 62f1d3402b78
Error: No such image: 3dd970e6b110
Error: No such image: f60d84d4d72c
Error: No such image: 07037e0784e0
Error: No such image: de25a81a5a0b
[root@jenkins-agent-1 docker]# docker system prune -a --volumes
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all volumes not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
[root@jenkins-agent-1 docker]# 

CodePudding user response:

  1. Try:- docker rmi -f $(docker image ls)
  2. If it still says Error: No such image , then most probably your images are removed and you can verify again with: docker image ls

CodePudding user response:

What will make it work will depend on what is actually causing the problem. But here are some possible solutions:

Solution 1: Restart the docker daemon:

# in case you are using Linux
sudo systemctl stop docker
sudo systemctl start docker

and then try to remove the images once again after that.

Solution 2: Try to remove the images as pointed out in this article

Solution 3: If nothing of that works, take a look at some answers replied on this other question. The accepted answer there has some side effects (read the comments related to it before doing that).

  • Related