Skip to content

Defining multiple buildx.cacheFrom #1822

@ggjulio

Description

@ggjulio

Description

I'm trying to setup a shared cache using cache-from and cache-to on a repo.

The docker doc says that we can use multiple caches.

But with the plugin I did not found a way to declare more that one cacheFrom for buildx.
Is it possible to do so ?

<!-- [...] redacted -->
<buildx>
	<platforms>
	     <platform>${docker.platforms}</platform>
	</platforms>
	<cacheTo>type=registry,ref=${docker.cache.registry}/my-image:${git.branch}</cacheTo>
	<cacheFrom>type=registry,ref=${docker.cache.registry}/my-image:${git.branch}</cacheFrom>
	<!-- the last cacheFrom overrides the first definition -->
	<cacheFrom>type=registry,ref=${docker.cache.registry}/my-image:master</cacheFrom>
</buildx>
<!-- [...] redacted  -->

Similarly to docker.cacheFrom.idx I also tried declaring a property list docker.buildx.cacheFrom.idx:

<buildx>
	<platforms>
	     <platform>${docker.platforms}</platform>
	</platforms>
	<cacheTo>type=registry,ref=${docker.cache.registry}/my-image:${git.branch}</cacheTo>
       <!-- Prop list does not work for buildx cachefrom
       Unable to parse configuration of mojo io.fabric8:docker-maven-plugin:0.45.0:build for parameter cacheFrom.1: Cannot find  'cacheFrom.1' in class io.fabric8.maven.docker.config.BuildXConfiguration  -->
	<cacheFrom.1>type=registry,ref=${docker.cache.registry}/my-image:${git.branch}</cacheFrom.1>
	<cacheFrom.2>type=registry,ref=${docker.cache.registry}/my-image:master</cacheFrom.2>
</buildx>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions