dockerdocker-imagedocker-containerdocker-cleanup

Can't remove image due to error: "Error response from daemon: reference does not exist"


I'm having a strange problem while trying to clear the images created by Docker. This is what I did:

Then this error: No such image: 2f21ea981017:latest comes up and I should ask, why? Where is such image? There is some kind of internal DB for Docker where it stores information?

After I run all the previous commands then I run the following and notice the output:

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              14.04.5             b1719e1db756        3 days ago          187.9 MB

But then I tried to remove the images again by running

$ docker rmi b1719e1db756
Error response from daemon: reference does not exist

And I got the same error, what I am missing here? How I can fix this?

I should add that I've run also the commands from this post but without success.


Solution

  • I will answer myself after some research and the great help from the people behind Docker at Github.

    Summary: At first I install docker by running the following command:

    $sudo dnf install docker -y
    

    That installed docker from RedHat fork and therefore the version was: 1.10.3, then using this version I built the image that was causing problems until now. After build the image I remove the docker 1.10.3 version and switch to docker-engine which is the official and install 1.12.1.

    The problem: I was trying to remove the image created under docker 1.10.3 but using docker 1.12.1 and from there is where the problem comes from.

    The solution: remove docker-engine and install temporary docker in order to remove the images created under such version.

    Note: for some reason after I follow every steps as shown above I run into the following issue:

    $docker images
    Error response from daemon: client is newer than server (client API version: 1.24, server API version: 1.22)
    

    Doing a dnf autoremove && dnf clean all and restarting docker fix the issue.

    Feel free to take a look here if you want more