mainframer
mainframer

Reputation: 22089

How to restore docker images which are removed by `docker rmi` command?

I issued command docker rmi 0d20855ef162 to remove it. How to find it back? I don't want to docker pull from the remote registry again, how?

Upvotes: 3

Views: 3618

Answers (1)

VonC
VonC

Reputation: 1325337

The rest DELETE action is called by api/client/rmi.go#L34, which in turn calls daemon/image_delete.go#L226

daemon.Graph().Delete(img.ID)

That calls graph/graph.go#L364-L375 which does:

tmp, err := graph.mktemp()
os.Rename(graph.imageRoot(id), tmp)
// Remove the trashed image directory
return os.RemoveAll(tmp)

So it does appear to delete the files from the imageRoot folder (if there is no conflict, meaning if the image is not referenced by anything else).

In that case, the answer would be that you cannot find that image back without pulling it again.

Upvotes: 8

Related Questions