Image automagically being deleted from cache

I am running Docker (edge channel) on Mac. Recently I have noticed images I have already downloaded, being lost from my image cache and having to be re-downloaded. There doesn’t seem to be any rhyme or reason to it.

For example I could pull the mysql image. And 5 minutes, maybe 1 hour, maybe a day later when I go to run that image it will re-download.

Here is a perfect example. I just built the following image (took forever because it had to compile R-script libraries):


** help
*** installing help indices
** building package indices
** testing if installed package can be loaded

  • DONE (rsconnect)

The downloaded source packages are in
‘/tmp/RtmpBf5M6e/downloaded_packages’
Removing intermediate container 3379463fb28b
—> e4d9aaa33b49
Step 12/12 : ENTRYPOINT [ “Rscript” ]
—> Running in bb37dc64a956
Removing intermediate container bb37dc64a956
—> 73992335d89d
Successfully built 73992335d89d
Successfully tagged pred:latest

~/code/products/pred/ [okta: expired] on git : master
› docker run -e “PROCESS_NUMBER=1” -e “LANES_PER_BATCH=10” -e “BATCH_NAME=pred01” pred:latest main.R
Unable to find image ‘pred:latest’ locally

› docker run -e “PROCESS_NUMBER=1” -e “LANES_PER_BATCH=10” -e “BATCH_NAME=pred01” 73992335d89d main.R
Unable to find image ‘73992335d89d:latest’ locally

As you can see, it says Successfully built 73992335d89d and tagged it. I immediately to try run that image (tried both by the tag and the image ID). In both cases it says Unable to find image and tries to pull it.

If I check output of docker images

› docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
pred 9dcef502ac0f 6 hours ago 2.97GB

You can see the latest is from 6 hours ago and the Image ID is not what is shown above.

What the heck is going on here?

The same is happening for me. The image gets removed automatically after approx. 5 minutes.

For anyone else having this problem, make sure you have enough free space on your disk, especially where you store the Docker images. On my Ubuntu 18.04.3, I had the same issue (with ~50GB free space in /), but once I passed ~100GB free space threshold, Docker started working again fine.

The same issue is happening for me on docker version 18.06, Does anyone have any solution