jib: Fails to pull image from registry - registry.redhat.io

Issue

We cannot pull an image from the registry.redhat.io as jib is returning an error 403 even if we pass the parameters -Djib.from.auth.username and -Djib.from.auth.password

Error

Caused by: org.apache.maven.plugin.MojoExecutionException: Build image failed, perhaps you should make sure you have permissions for registry.redhat.io/redhat-openjdk-18/openjdk18-openshift and set correct credentials. See https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#what-should-i-do-when-the-registry-responds-with-forbidden-or-denied for help
    at com.google.cloud.tools.jib.maven.BuildImageMojo.execute (BuildImageMojo.java:162)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    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:305)
    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:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    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.google.cloud.tools.jib.api.RegistryUnauthorizedException: Unauthorized for registry.redhat.io/redhat-openjdk-18/openjdk18-openshift
    at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:279)
    at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.callWithAllowInsecureRegistryHandling (RegistryEndpointCaller.java:175)
    at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call (RegistryEndpointCaller.java:152)
    at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint (RegistryClient.java:470)
    at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest (RegistryClient.java:299)
    at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest (RegistryClient.java:304)
    at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.pullBaseImage (PullBaseImageStep.java:212)
    at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call (PullBaseImageStep.java:169)
    at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call (PullBaseImageStep.java:60)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly (TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run (InterruptibleTask.java:69)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run (TrustedListenableFutureTask.java:78)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
Caused by: com.google.api.client.http.HttpResponseException: 403 Forbidden
<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>
An error occurred while processing your request.<p>
Reference&#32;&#35;199&#46;c5f7ef50&#46;1572258213&#46;23b79840
</BODY></HTML>

Steps to reproduce

mvn compile com.google.cloud.tools:jib-maven-plugin:build -Djib.from.image=registry.redhat.io/redhat-openjdk-18/openjdk18-openshift -Dimage=dabou/spring-boot-jib -Djib.from.auth.username=xxxxx -Djib.from.auth.password=yyyyy

Docker login

The command docker login -u xxxxx -p yyyyy registry.redhat.io works without issues as I can pull the image

docker login registry.redhat.io -u xxxxx -p yyyyy
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
docker pull registry.redhat.io/redhat-openjdk-18/openjdk18-openshift
Using default tag: latest
latest: Pulling from redhat-openjdk-18/openjdk18-openshift
Digest: sha256:873f79531ffa5b0783c0ffe6cdbdb05f1bcc0485d27b1aace16a9b062fc5bd77
Status: Image is up to date for registry.redhat.io/redhat-openjdk-18/openjdk18-openshift:latest
registry.redhat.io/redhat-openjdk-18/openjdk18-openshift:latest

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 23 (11 by maintainers)

Most upvoted comments

Many thanks for your help and quick reply/return 😃

I did a test and that works

[INFO] Containerizing application to quay.io/cmoulliard/hello-sb...
[WARNING] Base image 'registry.redhat.io/redhat-openjdk-18/openjdk18-openshift' does not use a specific image digest - build may not be reproducible
[INFO] Using credentials from Docker config (/Users/dabou/.docker/config.json) for quay.io/cmoulliard/hello-sb
[INFO] The base image requires auth. Trying again for registry.redhat.io/redhat-openjdk-18/openjdk18-openshift...
[INFO] Using credentials from <from><auth> for registry.redhat.io/redhat-openjdk-18/openjdk18-openshift
[INFO] Using base image with digest: sha256:9dab23924157b0c588f738c97b2a1f434315175b0be4156e1877028fa44360a8
[INFO] Executing tasks:
[INFO] [================              ] 53,6% complete
[INFO] > launching layer pushers
[INFO] > pulling base image layer sha256:00f17e0b37b05...