Home > Software design >  Does Docker FROM Keyword in Dockerfile look for the newest image?
Does Docker FROM Keyword in Dockerfile look for the newest image?

Time:10-21

I have a CI Runner that automatically builds a docker image from a dockerfile. My docker image is based on another docker image. So the beginning of my dockerfile looks like this:

FROM linktoimage/imagename:latest

Does docker check during the build process if my local version of imagename is still the latest (similar to docker pull? Because i noticed that my ci runner shows sn older version of imagename if i run docker images on it

CodePudding user response:

Does docker check during the build process if my local version of imagename is still the latest (similar to docker pull)?

No, docker will not do this by default because of the build cache. It will use whatever existing image it has locally in the cache [1].

You can however enable the behavior you desire by using the --no-cache option:

$ docker build . --no-cache=true

CodePudding user response:

Docker does not check for newer version of remote image. When building, Docker first check to see if the base image is in the local cache. If it finds it is uses it, otherwise it tries to pull it from the remote repository.

Source: https://stackoverflow.com/a/47327944/88513

  • Related