Skip to content

Add support for cache-to #2484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tpreviero
Copy link

In a Gradle build we're using the gradle-docker-plugin which is relying on this to perform its tasks.

While we've been able to leverage the Docker cache-from functionality that is being provided by both this library and the plugin, the cache-to seems to be missing.

I tried to implement the functionality upon which another PR (still to be created) to the gradle-docker-plugin aforementioned will need to be built on.

@tpreviero tpreviero requested a review from a team as a code owner July 30, 2025 09:33
@tpreviero
Copy link
Author

The test that I implemented is failing, but I'm not sure how to replicate that failure locally as mvn verify results in a

[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules
[INFO] Installing Central Publishing features
[INFO] 
[INFO] -----------------< com.github.docker-java:docker-java >-----------------
[INFO] Building docker-java 0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.github.docker-java:docker-java-core:jar:0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.github.docker-java:docker-java-transport-jersey:jar:0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.github.docker-java:docker-java-transport-netty:jar:0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.github.docker-java:docker-java-transport-okhttp:jar:0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for com.github.docker-java:docker-java-transport-httpclient5:jar:0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.504 s
[INFO] Finished at: 2025-08-01T16:35:37+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project docker-java: Could not resolve dependencies for project com.github.docker-java:docker-java:jar:0-SNAPSHOT
[ERROR] dependency: com.github.docker-java:docker-java-core:jar:0-SNAPSHOT (compile)
[ERROR]         Could not find artifact com.github.docker-java:docker-java-core:jar:0-SNAPSHOT
[ERROR] dependency: com.github.docker-java:docker-java-transport-jersey:jar:0-SNAPSHOT (compile)
[ERROR]         Could not find artifact com.github.docker-java:docker-java-transport-jersey:jar:0-SNAPSHOT
[ERROR] dependency: com.github.docker-java:docker-java-transport-netty:jar:0-SNAPSHOT (compile)
[ERROR]         Could not find artifact com.github.docker-java:docker-java-transport-netty:jar:0-SNAPSHOT
[ERROR] dependency: com.github.docker-java:docker-java-transport-okhttp:jar:0-SNAPSHOT (test)
[ERROR]         Could not find artifact com.github.docker-java:docker-java-transport-okhttp:jar:0-SNAPSHOT
[ERROR] dependency: com.github.docker-java:docker-java-transport-httpclient5:jar:0-SNAPSHOT (test)
[ERROR]         Could not find artifact com.github.docker-java:docker-java-transport-httpclient5:jar:0-SNAPSHOT
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

@eddumelendez
Copy link
Member

Hi, thanks for your contribution. I don't see the cacheTo query param in Build an Image. If exists then should be added similar to

if (command.getCacheFrom() != null && !command.getCacheFrom().isEmpty()) {
webTarget = webTarget.queryParam("cachefrom", jsonEncode(command.getCacheFrom()));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants