Sometime when we upgrade docker from a lower version to higher or any other situation, we might see some images by “docker images”, but while we run “docker image rm xxx”, it says no such image.
This means that the docker state is corrupted and we need clear the complete state.
In this case, we might clean the folder “/var/lib/docker”. We could issue the following command to rebuild a clean docker environment.
sudo service docker stop
sudo rm -rf /var/lib/docker
sudo service docker start
Note, all the images, containers and volumes will be cleaned, it go back to the state you just installed docker. Think it twice before you do this.