Description
When building images in a CI environment, the --cache-from flag allows to add images to consider as cache source for the current build. However, when the images are not yet present on that machine, docker will silently ignore the cache directive and do a full rebuild. A workaround is to do a docker pull of the cache-provider images before executing the build. Then the caching works as expected.
However, this is cumbersome and can easily be overlooked. I wonder why the CLI doesn't always try to pull cache-provider images upfront if the referenced cache-provider images are missing. Maybe there's a good reason for that. In that case, would it be possible to add a build option to automatically warm the image cache by pulling missing cache-provider images when executing the build?
Description
When building images in a CI environment, the
--cache-fromflag allows to add images to consider as cache source for the current build. However, when the images are not yet present on that machine, docker will silently ignore the cache directive and do a full rebuild. A workaround is to do adocker pullof the cache-provider images before executing the build. Then the caching works as expected.However, this is cumbersome and can easily be overlooked. I wonder why the CLI doesn't always try to pull cache-provider images upfront if the referenced cache-provider images are missing. Maybe there's a good reason for that. In that case, would it be possible to add a build option to automatically warm the image cache by pulling missing cache-provider images when executing the build?