----------------------------------------------------------------------getting errors
[root@localhost com-qiyun-discovery]# docker login [email protected] registry.cn-hangzhou.aliyuncs.com
Password:
Login Succeeded
[root@localhost com-qiyun-discovery]# mvn dockerfile:push
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building discovery 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- dockerfile-maven-plugin:1.3.6:push (default-cli) @ discovery ---
[INFO] The push refers to a repository [registry.cn-hangzhou.aliyuncs.com/veryqy/discovery]
[INFO] Image 26f1c075b2b5: Preparing
[INFO] Image 35c20f26d188: Preparing
[INFO] Image c3fe59dd9556: Preparing
[INFO] Image 6ed1a81ba5b6: Preparing
[INFO] Image a3483ce177ce: Preparing
[INFO] Image ce6c8756685b: Preparing
[INFO] Image 30339f20ced0: Preparing
[INFO] Image 0eb22bfb707d: Preparing
[INFO] Image a2ae92ffcd29: Preparing
[INFO] Image ce6c8756685b: Waiting
[INFO] Image 30339f20ced0: Waiting
[INFO] Image 0eb22bfb707d: Waiting
[INFO] Image a2ae92ffcd29: Waiting
## [ERROR] unauthorized: authentication required
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not push image
at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:90)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:240)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:229)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: com.spotify.docker.client.exceptions.DockerException: unauthorized: authentication 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.ProgressStream.tail(ProgressStream.java:74)
at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1291)
at com.spotify.docker.client.DefaultDockerClient.push(DefaultDockerClient.java:1271)
at com.spotify.plugin.dockerfile.PushMojo.execute(PushMojo.java:88)
... 24 more
[INFO] The push refers to a repository [registry.cn-hangzhou.aliyuncs.com/veryqy/discovery]
[INFO] Image 26f1c075b2b5: Preparing
[INFO] Image 35c20f26d188: Preparing
[INFO] Image c3fe59dd9556: Preparing
[INFO] Image 6ed1a81ba5b6: Preparing
[INFO] Image a3483ce177ce: Preparing
[INFO] Image ce6c8756685b: Preparing
[INFO] Image ce6c8756685b: Waiting
[INFO] Image 35c20f26d188: Waiting
[INFO] Image c3fe59dd9556: Waiting
[INFO] Image 6ed1a81ba5b6: Waiting
[INFO] Image a3483ce177ce: Waiting
[INFO] Image 30339f20ced0: Preparing
[INFO] Image 30339f20ced0: Waiting
[INFO] Image 0eb22bfb707d: Preparing
[INFO] Image 0eb22bfb707d: Waiting
[INFO] Image a2ae92ffcd29: Preparing
[INFO] Image a2ae92ffcd29: Waiting
[ERROR] unauthorized: authentication required
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.357 s
[INFO] Finished at: 2017-09-23T18:40:29+02:00
[INFO] Final Memory: 19M/46M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.6:push (default-cli) on project discovery: Could not push image: unauthorized: authentication required -> [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/MojoExecutionException
but using "docker push" works fine
[root@localhost com-qiyun-discovery]# ## docker push registry.cn-hangzhou.aliyuncs.com/veryqy/discovery:1.0.0
The push refers to a repository [registry.cn-hangzhou.aliyuncs.com/veryqy/discovery]
26f1c075b2b5: Pushed
35c20f26d188: Layer already exists
c3fe59dd9556: Layer already exists
6ed1a81ba5b6: Layer already exists
a3483ce177ce: Layer already exists
ce6c8756685b: Layer already exists
30339f20ced0: Layer already exists
0eb22bfb707d: Layer already exists
a2ae92ffcd29: Layer already exists
1.0.0: digest: sha256:00d93e690636212c5c8202c2d76528d3601255cb228b2a3ffc60a546954bce27 size: 2212
-------------------------------------------------------pom.xml
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>registry.cn-hangzhou.aliyuncs.com/veryqy/discovery</repository>
<tag>1.0.0</tag>
</configuration>
</plugin>
this way also throw error of "unauthorized: authentication required";.
pom.xml
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>registry.cn-hangzhou.aliyuncs.com/veryqy/discovery</repository>
<tag>1.0.0</tag>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
</configuration>
</plugin>
settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<servers>
<server>
<id>registry.cn-hangzhou.aliyuncs.com</id>
<username>[email protected]</username>
<password>123456</password>
</server>
</servers>
</settings>
This error occurs with 1.3.3 but does not occur in 1.3.2. Seems this regression was introduced in 1.3.3.
I think this is due to a problem in the docker-client dependency used by the plugin. The version used by dockerfile-maven 1.3.3+ is 8.8.1 and in 1.3.2 it was 8.8.0. I had the same error message.
I tried to change the used version by doing:
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.spotify</groupId>
<artifactId>docker-client</artifactId>
<version>8.8.4</version>
<classifier>shaded</classifier>
</dependency>
</dependencies>
And then it "works for me".
~Same issue here and I couldn't get it work even specifying docker-client version.~
nvm, I think my case was due to a different problem.
@honnix what was the problem then? I am facing a similar issue right now.
@gbtec-floriankopietz it was just my stupid mistake, basically working on a wrong git branch.
What was your issue? I worked for me once I fixed my own problem.
We have the same problem even when pulling a base image. We are using 2 docker registries:
We have both registries configured as servers in maven settings and it works with the old docker-maven-plugin. It pulls the base image from the one registry correctly and builds it locally, It pushes to the second registry without any problems. The Id of the server in maven setting matches the URL of the registry all the time.
We wanted to migrate our builds to this plugin (as the other one suggests it), we get the following exception when we run the build:
[INFO] Step 1/13 : FROM customer.vendor-registry.com/java/java-jdk8:latest
[INFO]
[ERROR] unauthorized: authentication required
[WARNING] An attempt failed, will retry 1 more times
org.apache.maven.plugin.MojoExecutionException: Could not build image
at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:185)
at com.spotify.plugin.dockerfile.BuildMojo.execute(BuildMojo.java:105)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.tryExecute(AbstractDockerMojo.java:252)
at com.spotify.plugin.dockerfile.AbstractDockerMojo.execute(AbstractDockerMojo.java:241)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: com.spotify.docker.client.exceptions.DockerException: unauthorized: authentication 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.build(DefaultDockerClient.java:1443)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1402)
at com.spotify.plugin.dockerfile.BuildMojo.buildImage(BuildMojo.java:178)
... 25 more
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
I think this is due to a problem in the docker-client dependency used by the plugin. The version used by dockerfile-maven 1.3.3+ is 8.8.1 and in 1.3.2 it was 8.8.0. I had the same error message.
I tried to change the used version by doing:
And then it "works for me".