"docker images" shows image, "docker rmi" says "no such image" or "reference does not exist"

This means that your docker state is corrupted and you need clear the complete state

sudo service docker stop
sudo rm -rf /var/lib/docker
sudo service docker start

This will start docker fresh without any existing data. Try pulling deleting the image after this and see if all works. If it doesn't then there is some issue that needs to be looked into


Try first a docker image prune or even docker image prune -a, to remove any image unused/not associated to at least one container.

If those are still listed, restart your docker daemon.


To avoid deleting all of your docker data and starting from scratch, you can also attempt to manually clean up the broken references by matching the bad image references to the files in /var/lib/docker/image/devicemapper/imagedb/content/sha256. Once the corresponding file is deleted there, it will no longer show up in subsequent calls to docker images, and no daemon restarts are required.

Tags:

Linux

Docker