Jib: Retrieving registry credentials for registry.hub.docker.com is very slow

Created on 18 Jul 2018  Â·  4Comments  Â·  Source: GoogleContainerTools/jib

Description of the issue:
where i push my image to private repository , i got this message:

Retrieving registry credentials for registry.hub.docker.com.

maven build log:

[INFO] Containerizing application to 172.21.16.8:5000/register-xxx:built-w-j...
[INFO] 
[INFO] Retrieving registry credentials for 172.21.16.8:5000...
[INFO] Getting base image frolvlad/alpine-oraclejdk8...
[INFO] Building dependencies layer...
[INFO] Building resources layer...
[INFO] Building classes layer...
↓↓↓↓↓ start slow ↓↓↓↓
[INFO] Retrieving registry credentials for registry.hub.docker.com...(  1 )

[INFO] Finalizing...
[INFO] 
[INFO] Container entrypoint set to [java, -cp, /app/libs/*:/app/resources/:/app/classes/, cn.com.share.RegisterApplication]
[INFO] 
[INFO] Built and pushed image as 172.21.16.8:5000/register-xxx:built-w-j
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] sharebang-service .................................. SUCCESS [  1.244 s]
[INFO] register ........................................... SUCCESS [ 18.557 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

question:
this step very slow when maven running here( 1 )Retrieving registry credentials for registry.hub.docker.com, because i can not visit docker.com

How to jump that step ?

THX.

Most helpful comment

Oh, now I get it. You are pulling the base image from Docker Hub. Jib needs to contact Docker Hub to ensure that you always get the up-to-date image, even if it caches the image locally. (And Docker Hub requires auth even when pulling public images.)

One workaround I can think of is to save the base image to your repository and configure Jib to use it.

All 4 comments

Hi @shijiaoming,

You cannot skip contacting Docker Hub because you (Jib) are to push the built image to the remote Docker Hub registry. If you are asking if Jib has a way to not push an image to a remote registry but rather save it to a local Docker daemon, you can do mvn compile jib:dockerBuild.

@chanseokoh
I just want to push the built image to my private docker registry. and it's address like this: 172.21.16.8:5000. It's on my cloud server.
If i cannot skip contacting Docker Hub use some configuration then I can only keep the current configuration.

Thanks

Oh, now I get it. You are pulling the base image from Docker Hub. Jib needs to contact Docker Hub to ensure that you always get the up-to-date image, even if it caches the image locally. (And Docker Hub requires auth even when pulling public images.)

One workaround I can think of is to save the base image to your repository and configure Jib to use it.

@chanseokoh
thanks a lot .
The problem is clear.
I have saved it in my repository .

[root@VM_16_8_centos ~]# docker images frolvlad/alpine-oraclejdk8
REPOSITORY                   TAG                 IMAGE ID            CREATED             SIZE
frolvlad/alpine-oraclejdk8   latest              a83d02d8e0ec        4 months ago        171MB

My current configuration:
pom.xml

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>0.9.6</version>
    <configuration>
        <from>
            <image>frolvlad/alpine-oraclejdk8</image>
        </from>
        <to>
            <image>172.21.16.8:5000/${project.name}:${project.version}</image>
        </to>
        <container>
            <jvmFlags>
                <jvmFlag>-Xms128m</jvmFlag>
                <jvmFlag>-Xmx128m</jvmFlag>
                <jvmFlag>-Duser.timezone=GMT+08</jvmFlag>
            </jvmFlags>
            <ports>
                <port>${project.port}</port>
            </ports>
            <format>Docker</format>
        </container>
        <allowInsecureRegistries>true</allowInsecureRegistries>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
</plugin>

maven build details:

# mvn clean package -pl account -am -Dmaven.test.skip=true -Pdev
[INFO] Scanning for projects...
....
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ account ---
[INFO] Building jar: /var/lib/jenkins/workspace/dev-account/account/target/account-1.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) @ account ---
[INFO] 
[INFO] --- jib-maven-plugin:0.9.6:build (default) @ account ---
[WARNING] Base image 'frolvlad/alpine-oraclejdk8' does not use a specific image digest - build may not be reproducible
[INFO] 
[INFO] Containerizing application to 172.21.16.8:5000/account:1.0.0-SNAPSHOT...
[INFO] 
[INFO] Retrieving registry credentials for 172.21.16.8:5000...
[INFO] Getting base image frolvlad/alpine-oraclejdk8...
[INFO] Building dependencies layer...
[INFO] Building resources layer...
[INFO] Building classes layer...
[INFO] Retrieving registry credentials for registry.hub.docker.com...
[INFO] Finalizing...
[INFO] 
[INFO] Container entrypoint set to [java, -Xms128m, -Xmx128m, -Duser.timezone=GMT+08, -cp, /app/libs/*:/app/resources/:/app/classes/, cn.com.share.AccountApplication]
[INFO] 
[INFO] Built and pushed image as 172.21.16.8:5000/account:1.0.0-SNAPSHOT
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] sharebang-service .................................. SUCCESS [  1.254 s]
[INFO] account ............................................ SUCCESS [ 22.661 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.255 s
[INFO] Finished at: 2018-07-19T09:10:21+08:00
[INFO] Final Memory: 94M/774M
[INFO] ------------------------------------------------------------------------
Was this page helpful?
0 / 5 - 0 ratings