Is there a setting I can change to have docker check for updated images, instead of using its cache forever?

One of our images was updated four days ago, but docker would only use the month-old cached version until I ran docker system prune -a, which is rather drastic. There’s also a --no-cache options. Is there an option where docker uses its cache, but actually looks for more recent images (as a web browser does)?

1 Like

Plain Docker pulls a tag during a deployment when it’s not present in the local repo cache.
Docker Swarm on the other hand allways pulls the tag on every deployment.

On plan Docker, you can specificly update a mutable tag with docker pull image:tag
It is neither desirable to have mutable tags in production, nor to have them automaticly updated in the background.

1 Like

Thank you, but I can’t relate your answer to my question.

Not including Docker Swarm (since I don’t use it and can’t speak to its capability), my understanding is that you need to execute a “docker pull” to download the latest version of the image (which you’ve done) and then when you redeploy (IE: “docker stop / docker rm / docker run”) it uses the most updated version of the image and only downloads updates if there is no local image.

On my system I’ve written a script in cron to do a docker pull and then if anything downloads, stop, rm and deploy the container again. I’ve not heard/read the term “mutable tags”, but if it’s like using “:latest” then I do that most of the time for my own sanity. If I read right, the idea that automatic updates on a production system is undesirable is more the stuff of opinions, and one I don’t necessarily always share.

@dougnchannel You, are right, I shouldhave starte with: no, there is no such option buildin in Docker. That said, you might want to take a look at Watchtower. Periodicly it checks if an updated image exists for your containers. For each updateable image, it pulls the new image, deletes the old container and create a new container based on the new image having the same configuration as the old container

@cincitech
mutable as in changeble. Even though the tag is fixed, its does not point to a defined version of the metadata and all its image layers, thus not the same image.