-
Notifications
You must be signed in to change notification settings - Fork 198
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
.mavenrc
not honored
#909
Comments
Could you please run |
Why do you think so? I do not see any system properties mentioned in your report. |
BTW, does the problem persist when you start with a fresh daemon after authenticating with docker? Something like
If that works, it could mean that the docker plugin is keeping some global state, which would have to be fixed in the plugin. |
No, still fails with missing authentication. I only have to login to our Docker registry once. After a successful login, |
$ mvnd package
[omitted previous steps like compile]
[INFO] --- dockerfile:1.4.13:build (package) @ <module> ---
[INFO] Google Container Registry support is disabled
[INFO] dockerfile: <path>/target/Dockerfile
[INFO] contextDirectory: <path>/<module>
[INFO] Building Docker context <path>/<module>
[INFO] Path(dockerfile): <path>/<module>/target/Dockerfile
[INFO] Path(contextDirectory): <path>/<module>
[INFO]
[INFO] Image will be built as <company-registry-url>/<module>:<version>
[INFO]
[INFO] Step 1/20 : FROM <company-registry-url>/eclipse-temurin:17.0.8_7-jre-alpine
[INFO]
[ERROR] Head "<company-registry-url/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
[WARNING] An attempt failed, will retry 1 more timesorg.apache.maven.plugin.MojoExecutionException: Could not build image
at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:247)
at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:135)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:265)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:254)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:143)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:318)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:214)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:74)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:209)
at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
Caused by: com.spotify.docker.client.exceptions.DockerException: Head "<company-registry-url>/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError (LoggingProgressHandler.java:105)
at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress (LoggingProgressHandler.java:63)
at com.spotify.docker.client.DefaultDockerClient$BuildProgressHandler.progress (DefaultDockerClient.java:312)
at com.spotify.docker.client.ProgressStream.tail (ProgressStream.java:77)
at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2754)
at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2738)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
[INFO] Google Container Registry support is disabled
[INFO] dockerfile: <path>/target/Dockerfile
[INFO] contextDirectory: <path>/<module>
[INFO] Building Docker context <path>/<module>
[INFO] Path(dockerfile): <path>/<module>/target/Dockerfile
[INFO] Path(contextDirectory): <path>/<module>
[INFO]
[INFO] Image will be built as <company-registry-url>/<module>:<version>
[INFO]
[INFO] Step 1/20 : FROM <company-registry-url>/eclipse-temurin:17.0.8_7-jre-alpine
[INFO]
[ERROR] Head "<company-registry-url>/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] --------------------------------------------------------------------------------------------------------------------------
[INFO] Total time: 33.002 s (Wall Clock)
[INFO] Finished at: 2024-02-14T07:09:46Z
[INFO] --------------------------------------------------------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.13:build (package) on project <module>: Could not build image: Head "<company-registry-url>/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required -> [Help 1]org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.13:build (package) on project <module>: Could not build image
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:336)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:318)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:214)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:74)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:209)
at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
Caused by: org.apache.maven.plugin.MojoExecutionException: Could not build image
at com.spotify.plugin.dockerfile.BuildMojo.buildImage (BuildMojo.java:247)
at com.spotify.plugin.dockerfile.BuildMojo.execute (BuildMojo.java:135)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute (AbstractDockerMojo.java:265)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute (AbstractDockerMojo.java:254)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:143)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:318)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:214)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:74)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:111)
at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:209)
at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840)
Caused by: com.spotify.docker.client.exceptions.DockerException: Head "<company-registry-url>/eclipse-temurin/manifests/17.0.8_7-jre-alpine": unknown: Authentication is required
at com.spotify.plugin.dockerfile.LoggingProgressHandler.handleError (LoggingProgressHandler.java:105)
at com.spotify.plugin.dockerfile.LoggingProgressHandler.progress (LoggingProgressHandler.java:63)
at com.spotify.docker.client.DefaultDockerClient$BuildProgressHandler.progress (DefaultDockerClient.java:312)
at com.spotify.docker.client.ProgressStream.tail (ProgressStream.java:77)
at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2754)
at com.spotify.docker.client.DefaultDockerClient$ResponseTailReader.call (DefaultDockerClient.java:2738)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
at java.lang.Thread.run (Thread.java:840) |
I guess one would have to debug the execution of the plugin to see why it does not pick the credentials. Esp. the AuthSuppliers enabled in https://github.com/spotify/dockerfile-maven/blob/986f960cb82085d2f666acd6c2682672d47f5bb0/plugin/src/main/java/com/spotify/plugin/dockerfile/AbstractDockerMojo.java#L450 would be interesting. |
The problem is the property I set it to Setting it as a CLI option does work: mvnd package -Ddockerfile.useMavenSettingsForAuth=true So does adding it to the But it does not work, when I add it to the user property file Stated in this comment: #567 (comment) How can I achieve that? Is that even possible? (we set other options like the path to a keystore with |
Thanks for the investigation @reissseb. Apparently mvnd does not honor .mavenrc. In case of stock Maven it is sourced inside the
It is honored by I do not think Another possible way of solving this would be to put those local properties into a profile in settings.xml that would be active by default. @gnodet do you think we should support |
.mavenrc
not honored
That doesn't work either. The property is set as a MAVEN_OPTS="-Ddockerfile.useMavenSettingsForAuth=true" And I guess I am back to using Thanks for your help @ppalaga |
I am using the Maven plugin
dockerfile-maven-plugin
to build a Docker image for a maven module.To build the image I just run
mvn package
. I have to login to the company registry once withdocker login
before running the Maven build for the first time. After that I don't have to do anything anymore.mvn package
is enough to build my image.But that doesn't work with
mvnd package
:It looks a bit like, that
mvnd
doesn't use the local docker daemon to build the imageThe problem sounds similar to #157
The text was updated successfully, but these errors were encountered: