question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confusing 401 Unauthorized error when using multi-level repository name on Docker Hub

See original GitHub issue

I have simple Spring Boot app. I tried to create an docker image of it using jib-maven plugin. But when I build this app its failing with 401 Unauthorized exception. But I am giving all the configurations correctly in logs I can see its been read correctly but while pushing its failing with I/O error for image…

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>2.4.0</version>
    <configuration>
         <from>
            <image>openjdk:latest</image>
            <auth>
              <username>userName</username>
              <password>password</password>
            </auth>
        </from> 
         <to>
            <image><userName>/java-spring/${project.artifactId}:latest</image>
            <auth>
              <username>userName</username>
              <password>password</password>
            </auth>
        </to> 
        <container>
            <jvmFlags>
                <jvmFlag>-Xms512m</jvmFlag>
                <jvmFlag>-Xmx512m</jvmFlag>
            </jvmFlags>
        </container>
    </configuration> 
   <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>build</goal>
      </goals>
    </execution>
  </executions>
</plugin>

I am using mvn clean install -Djib.httpTimeout=0 -X while building

[DEBUG] bearer auth succeeded for registry-1.docker.io/userName/java-spring/singin
[DEBUG] TIMED   Authenticating push to registry-1.docker.io : 3433.0 ms
[DEBUG] TIMING  Preparing layer pushers
[DEBUG] TIMED   Preparing layer pushers : 2.0 ms
[DEBUG] TIMING  Pushing BLOB digest: sha256:6a1d32d7f6ff4a41815f4be581691138a588a3e8b4faa839e1e80f7e51b2cd6f, size: 1544
[DEBUG] TIMING  Pushing BLOB digest: sha256:fe3d76ed81f8e2c7419641c7accf6a0f1c4d15a5b5e344d5848422d7e481edd2, size: 314
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] TIMED   Pulling base image manifest : 4079.0 ms
[DEBUG] TIMING  Preparing base image layer pullers
[DEBUG] TIMED   Preparing base image layer pullers : 0.0 ms
[DEBUG] TIMING  Preparing layer pushers
[DEBUG] TIMED   Preparing layer pushers : 1.0 ms
[DEBUG] TIMING  Pulling base image layer sha256:69e2f037cdb30c8d329b17dad42cd9d92a45d93c17e6699650b23c55eceacb5f
[DEBUG] TIMING  Pulling base image layer sha256:42196c7f3671dd040a08f3515d758e322ed3276abedebd86072bb966f068a783
[DEBUG] TIMING  Pulling base image layer sha256:3e010093287c245d72a774033b4cddd6451a820bfbb1948c97798e1838858dd2
[DEBUG] TIMING  Pulling base image layer sha256:d0e5d6aa3b5285b5d96315f094cdf61ee0c54fbbf9c2e559a09a85afcdc65336
[DEBUG] TIMING  Pulling base image layer sha256:423773833537fe0e40fa349a4bc0a2001340dac0c77d7a9fcf693df3068d4a3d
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] TIMED   Pushing BLOB digest: sha256:6a1d32d7f6ff4a41815f4be581691138a588a3e8b4faa839e1e80f7e51b2cd6f, size: 1544 : 2713.0 ms
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] TIMED   Pushing BLOB digest: sha256:fe3d76ed81f8e2c7419641c7accf6a0f1c4d15a5b5e344d5848422d7e481edd2, size: 314 : 2853.0 ms
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] Building dependencies layer built sha256:e33c10e34799462008afa4ef873291b337878a958002e7567db5bbefa9602633
[DEBUG] TIMED   Building dependencies layer : 6513.0 ms
[DEBUG] TIMING  Pushing BLOB digest: sha256:e33c10e34799462008afa4ef873291b337878a958002e7567db5bbefa9602633, size: 16212760
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] TIMED   Pulling base image layer sha256:69e2f037cdb30c8d329b17dad42cd9d92a45d93c17e6699650b23c55eceacb5f : 2622.0 ms
[DEBUG] refreshing bearer auth token for registry-1.docker.io/userName/java-spring/singin...
[DEBUG] TIMED   Pulling base image layer sha256:42196c7f3671dd040a08f3515d758e322ed3276abedebd86072bb966f068a783 : 2660.0 ms
[DEBUG] TIMED   Building and pushing image : 7058.0 ms
[ERROR] I/O error for image [registry-1.docker.io/userName/java-spring/singin]:
[DEBUG] TIMED   Pulling base image layer sha256:423773833537fe0e40fa349a4bc0a2001340dac0c77d7a9fcf693df3068d4a3d : 2707.0 ms
[ERROR]     java.net.SocketException
[ERROR]     Socket closed
[DEBUG] TIMED   Pulling base image layer sha256:3e010093287c245d72a774033b4cddd6451a820bfbb1948c97798e1838858dd2 : 2726.0 ms
[DEBUG] TIMED   Pushing BLOB digest: sha256:e33c10e34799462008afa4ef873291b337878a958002e7567db5bbefa9602633, size: 16212760 : 390.0 ms
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
uthircloudcommented, Jul 31, 2020

Oh yes really appreciate your help. I got the clue after your guidance to enable the logging thanks a lot.

On Fri, Jul 31, 2020 at 3:55 PM Chanseok Oh notifications@github.com wrote:

Ah, yes, I forget that Docker Hub does not support multi-level repository name https://github.com/docker/hub-feedback/issues/1404. It doesn’t support <account>/level-1/level-2/…, for example.

I see that jib-maven-plugin successfully ran without an error. The warning after jib-maven-plugin is coming from a different plugin and unrelated to Jib.

[INFO] — jib-maven-plugin:2.4.0:build (default) @ singin — [WARNING] ‘mainClass’ configured in ‘maven-jar-plugin’ is not a valid Java class: ${start-class} [INFO] [INFO] Containerizing application to …/singin… [WARNING] Base image ‘openjdk’ does not use a specific image digest - build may not be reproducible [INFO] Using credentials from <to><auth> for …/singin [INFO] Getting manifest for base image openjdk… [INFO] Building classes layer… [INFO] Building resources layer… [INFO] Building dependencies layer… [INFO] The base image requires auth. Trying again for openjdk… [INFO] Using credentials from Maven settings file for openjdk [INFO] Using base image with digest: sha256:afe7bebffdc20fb992bd67dba0a15359db806a5c3ee5bb78e88ac3c9f20c684b [INFO] [INFO] Container entrypoint set to [java, -Xms512m, -Xmx512m, -cp, /app/resources:/app/classes:/app/libs/*, …SinginApplication] [INFO] [INFO] Built and pushed image as …/singin

I believe your issue is resolved, but I will leave this issue open so that we show a better message when this happens.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GoogleContainerTools/jib/issues/2650#issuecomment-667323777, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMCLINBNKCDKHUTN54H75GDR6MOTFANCNFSM4PQPRDWQ .

0reactions
chanseokohcommented, Jul 31, 2020

Ah, yes, I forget that Docker Hub does not support multi-level repository names. It doesn’t support <account>/level-1/level-2/..., for example.

I see that jib-maven-plugin successfully ran without an error. The warning after jib-maven-plugin is coming from a different plugin and is unrelated to Jib.

[INFO] --- jib-maven-plugin:2.4.0:build (default) @ singin ---
[WARNING] 'mainClass' configured in 'maven-jar-plugin' is not a valid Java class: ${start-class}
[INFO]
[INFO] Containerizing application to .../singin...
[WARNING] Base image 'openjdk' does not use a specific image digest - build may not be reproducible
[INFO] Using credentials from <to><auth> for .../singin
[INFO] Getting manifest for base image openjdk...
[INFO] Building classes layer...
[INFO] Building resources layer...
[INFO] Building dependencies layer...
[INFO] The base image requires auth. Trying again for openjdk...
[INFO] Using credentials from Maven settings file for openjdk
[INFO] Using base image with digest: sha256:afe7bebffdc20fb992bd67dba0a15359db806a5c3ee5bb78e88ac3c9f20c684b
[INFO]
[INFO] Container entrypoint set to [java, -Xms512m, -Xmx512m, -cp, /app/resources:/app/classes:/app/libs/*, ....SinginApplication]
[INFO]
[INFO] Built and pushed image as .../singin

I believe your issue is resolved, but I will leave this issue open so that we show a better message when this happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker - Jib maven plugn is not able to push image from local ...
I have created a repo manually in my DockerHub as java-spring and appended it in image URL and it will become multilevel repo...
Read more >
401 unauthorized when pushing an image layer to dockerhub
I have been trying to use curl cmd to push an image layer to my repository on dockerhub here https://hub.docker.com/r/patiner/busybox/.
Read more >
sitemap_3.xml - MongoDB
... /t/internal-authentication-with-keyfiles-not-matching-file-name/156768 ... -error-unauthorized-command-createindexes-requires-authentication/161699 ...
Read more >
index-2.xml - Microsoft Support
https://support.microsoft.com/en-us/account-billing/prevent-unauthorized- ... en-us/topic/you-may-receive-the-the-local-device-name-is-already-in-use-error- ...
Read more >
Cloud Container Engine - Best Practices
All other trademarks and trade names mentioned in this document are the property of ... 3.1.2 Migrating Images to SWR Using Docker Commands....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found