Skip to content

Add option to warm build cache for --cache-from when building images #1597

@corneliusweig

Description

@corneliusweig

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions