jib: Unauthorized for registry-1.docker.io after first push
Environment: macOS Monterey 12.3 MacBook Pro 16 M1
-
Jib version: 3.3.1
-
Build tool: Maven home: /opt/homebrew/Cellar/maven/3.8.6/libexec java version “17.0.5” 2022-10-18 LTS Java™ SE Runtime Environment (build 17.0.5+9-LTS-191) Java HotSpot™ 64-Bit Server VM (build 17.0.5+9-LTS-191, mixed mode, sharing)
-
OS: macOS Monterey Description of the issue I have a multi-project with several modules. When I pushed images I came across with Unauthorized issue but I change json.config like here https://github.com/GoogleContainerTools/jib/issues/3677 and it works only first push when docker hub doesn’t have already such images. If push twice I get Unauthorized for registry-1.docker.io
if I delete all images from dockerhub and push then it works only first time, second, third so on push with Unauthorized I use mvn -X clean package -P build-docker-image
if I remove fraud module then error appears in next eureka-server module
Main POM.xml
https://github.com/IgorZaporozhtsev/zeeservices/blob/master/pom.xml
[INFO] zeeservices … SUCCESS [ 0.001 s] [INFO] amqp … SUCCESS [ 1.019 s] [INFO] clients … SUCCESS [ 0.248 s] [INFO] customer … SUCCESS [ 15.223 s] [INFO] fraud … FAILURE [ 10.057 s] [INFO] eureka-server … SKIPPED [INFO] notification … SKIPPED [INFO] api-gateway … SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------
Expected behavior:
All images will be pushed and updated latest
Steps to reproduce:
push twice to docker Hub
mvn clean package -P build-docker-image
jib-maven-plugin Configuration:
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (maybe moved to parent pom) -->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<from>
<image>eclipse-temurin:17</image>
<platforms>
<platform>
<architecture>arm64</architecture>
<os>linux</os>
</platform>
<platform>
<architecture>amd64</architecture>
<os>linux</os>
</platform>
</platforms>
</from>
<to>
<tags>
<tag>latest</tag>
</tags>
</to>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Log output:
[INFO] Executing tasks:
[INFO] [============ ] 41.7% complete
[INFO] > checking base image layer sha256:10175de2f0c4...
[INFO] > checking base image layer sha256:f7f2e5e37e70...
[INFO] > checking base image layer sha256:2c8f048f32cc...
[INFO] > checking base image layer sha256:a3effab4d2ab...
[INFO] > checking base image layer sha256:6e3729cf69e0...
[INFO] > checking base image layer sha256:4d8d923227d8...
[INFO] > checking base image layer sha256:eda8241fd25f...
[INFO] > checking base image layer sha256:35dccabde73d...
[INFO] > scheduling building manifests
[INFO] > launching layer pushers
[INFO] > scheduling pushing container configurations
[INFO] > launching layer pushers
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for zeeservices 1.0-SNAPSHOT:
[INFO]
[INFO] zeeservices ........................................ SUCCESS [ 0.054 s]
[INFO] amqp ............................................... SUCCESS [ 1.096 s]
[INFO] clients ............................................ SUCCESS [ 0.263 s]
[INFO] customer ........................................... SUCCESS [ 15.143 s]
[INFO] fraud .............................................. FAILURE [ 10.812 s]
[INFO] eureka-server ...................................... SKIPPED
[INFO] notification ....................................... SKIPPED
[INFO] api-gateway ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.519 s
[INFO] Finished at: 2022-12-09T19:36:54+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.3.1:build (default) on project fraud: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/booratina/fraud' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help: Unauthorized for registry-1.docker.io/booratina/fraud: 401 Unauthorized
[ERROR] HEAD https://registry-1.docker.io/v2/booratina/fraud/blobs/sha256:9c6d21522d145d7d24f42d96ad9530f8c051affa1e303695c786a70e623aad47
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.3.1:build (default) on project fraud: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/booratina/fraud' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
at java.lang.reflect.Method.invoke (Method.java:578)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/booratina/fraud' are set up correctly. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-unauthorized for help
at com.google.cloud.tools.jib.maven.BuildImageMojo.execute (BuildImageMojo.java:181)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
at java.lang.reflect.Method.invoke (Method.java:578)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: com.google.cloud.tools.jib.api.RegistryUnauthorizedException: Unauthorized for registry-1.docker.io/booratina/fraud
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:163)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:114)
at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint (RegistryClient.java:623)
at com.google.cloud.tools.jib.registry.RegistryClient.checkBlob (RegistryClient.java:474)
at com.google.cloud.tools.jib.builder.steps.PushBlobStep.call (PushBlobStep.java:74)
at com.google.cloud.tools.jib.builder.steps.PushLayerStep.call (PushLayerStep.java:92)
at com.google.cloud.tools.jib.builder.steps.PushLayerStep.call (PushLayerStep.java:33)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:131)
at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:74)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1589)
Caused by: com.google.cloud.tools.jib.http.ResponseException: 401 Unauthorized
HEAD https://registry-1.docker.io/v2/booratina/fraud/blobs/sha256:9c6d21522d145d7d24f42d96ad9530f8c051affa1e303695c786a70e623aad47
at com.google.cloud.tools.jib.http.FailoverHttpClient.call (FailoverHttpClient.java:355)
at com.google.cloud.tools.jib.http.FailoverHttpClient.call (FailoverHttpClient.java:266)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:138)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:114)
at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint (RegistryClient.java:623)
at com.google.cloud.tools.jib.registry.RegistryClient.checkBlob (RegistryClient.java:474)
at com.google.cloud.tools.jib.builder.steps.PushBlobStep.call (PushBlobStep.java:74)
at com.google.cloud.tools.jib.builder.steps.PushLayerStep.call (PushLayerStep.java:92)
at com.google.cloud.tools.jib.builder.steps.PushLayerStep.call (PushLayerStep.java:33)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:131)
at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:74)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1589)
Caused by: com.google.api.client.http.HttpResponseException: 401 Unauthorized
HEAD https://registry-1.docker.io/v2/booratina/fraud/blobs/sha256:9c6d21522d145d7d24f42d96ad9530f8c051affa1e303695c786a70e623aad47
at com.google.api.client.http.HttpResponseException$Builder.build (HttpResponseException.java:293)
at com.google.api.client.http.HttpRequest.execute (HttpRequest.java:1118)
at com.google.cloud.tools.jib.http.FailoverHttpClient.call (FailoverHttpClient.java:349)
at com.google.cloud.tools.jib.http.FailoverHttpClient.call (FailoverHttpClient.java:266)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:138)
at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:114)
at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint (RegistryClient.java:623)
at com.google.cloud.tools.jib.registry.RegistryClient.checkBlob (RegistryClient.java:474)
at com.google.cloud.tools.jib.builder.steps.PushBlobStep.call (PushBlobStep.java:74)
at com.google.cloud.tools.jib.builder.steps.PushLayerStep.call (PushLayerStep.java:92)
at com.google.cloud.tools.jib.builder.steps.PushLayerStep.call (PushLayerStep.java:33)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:131)
at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:74)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1589)
[ERROR]
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :fraud
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (13 by maintainers)
Hello guys I solved the problem with: -docker login registry-1.docker.io then enter your username and password it worked for me !
@IgorZaporozhtsev Apologies for sounding like a broken record - given the other follow-ups in this thread, I suspect there is something specific in your setup that is likely misconfigured here. I’ve summarized a couple of troubleshooting suggestions given the information provided:
Is
docker-credential-desktopthe credential helper that you are expecting to use? If so, could you try runningdocker-credential-desktop listto check whether the credentials are stored as expected?docker logoutanddocker login registry-1.docker.ioagain to authenticate.<credHelper>desktop</credHelper>(or some other credential helper CLI tool)The
Main class was not foundmessages look unrelated to the credentials issue, and I wonder if you’ve updated anything to introduce this error later. Going back to your initial issue description where the first image push works, but not successive ones when runningmvn -X clean package jib:build- could you try runningmvn -X clean package jib:build -Djib.serialize=true(adding the-Djib.serialize=trueflag to the equivalent command) to see if there could be any additional information from the logs?[INFO] Using credentials fromor[INFO] Using credential helperwould be helpful for further troubleshooting.If neither suggestion above is fruitful, you could also try taking jib’s multimodule example, adjust it to push to a personal docker hub registry, and see if you run into the same errors. (I tried this out but couldn’t seem to to locally reproduce your error with the same
config.json.)@magician20 Thanks for the update - glad to hear your credential issue was resolved!