Docker Community Forums

Share and learn in the Docker community.

Safe combination of --pull option --cache-from option on docker build

build

(Thomas Beekeeper) #1

Hi,

is it safe to combine the --pull option and the --cache-from option when building a container?

Imagine we have a image ‘foo’ which is based on (FROM) ‘alpha’.

In a build step I could first pull ‘foo’ and then build it again with the --cache-from option.
This could safe build time.

What happens when I add the --pull option too?

Imagine the base image ‘alpha’ has a newer version.

I would expect that in a first step ‘alpha’ is pulled and then the cache is never used when the ‘foo’-image pulled for the --cache-from option has an older ‘alpha’ layer inside.
All should then created new.

Is this assumption right?

Also have a look at: https://github.com/moby/moby/issues/38660

Best regards
Thomas