skip to Main Content

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

2

Answers


  1. 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

    Login or Signup to reply.
  2. 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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search