Closed SeetaramOnCloud closed 3 years ago
How do you normally authorize with Docker hub?
This is the first time I am using docker push
I never used it before
<image.path>registry.hub.docker.com/seetaramao/my-demos/springboot-jim-image</image.path>
If your Docker Hub account name is seetaramao
, a destination image reference should be in the form of <account name>/<image-name>
. (You don't specify a hostname for Docker Hub.) And unlike other registries, Docker Hub doesn't support multi-level repository names, so you can't have seetaramao/my-demos/another-level
. So, you can set it to, e.g.,
<image.path>seetaramao/springboot-jim-image-demo</image.path>
And the following line in settings.xml
should work and require no change.
<id>registry.hub.docker.com</id>
Closing as a dup of #2650.
Unrelated, if you pass --batch-mode
(or -B
) to Maven, you can disable the progress bar clutter in the output.
Environment:
- Jib version: 2.5.0
- Build tool: Maven
- OS: Windows 10 Home
Description of the issue: Getting authorization error while pushing build to docker hub.
Expected behavior: Docker image should be available in docker hub
Steps to reproduce:
- Run jib:build from maven plugins
jib-maven-plugin
Configuration:<?xml version="1.0" encoding="UTF-8"?> <project 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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.1</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.learn.fun</groupId> <artifactId>MySpringBootApp</artifactId> <version>0.0.1-SNAPSHOT</version> <name>MySpringBootApp</name> <description>Demo project for Spring Boot</description> <properties> <java.version>11</java.version> <image.path>registry.hub.docker.com/seetaramao/my-demos/springboot-jim-image</image.path> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>jib-maven-plugin</artifactId> <version>2.5.0</version> <configuration> <from> <image>gcr.io/distroless/java:11</image> </from> <to> <image>registry.hub.docker.com/seetaramao/my-demos/springboot-jim-image</image> </to> </configuration> </plugin> </plugins> </build> </project>
Log output:
"C:\Program Files\Java\jdk-16\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\kishore\dev\MySpringBootApp -Dmaven.home=C:\Users\seeta\.m2\wrapper\dists\apache-maven-3.8.1-bin\2l5mhf2pq2clrde7f7qp1rdt5m\apache-maven-3.8.1 -Dclassworlds.conf=C:\Users\seeta\.m2\wrapper\dists\apache-maven-3.8.1-bin\2l5mhf2pq2clrde7f7qp1rdt5m\apache-maven-3.8.1\bin\m2.conf "-Dmaven.ext.class.path=D:\software\IntelliJ IDEA Community Edition 2020.2.1\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\software\IntelliJ IDEA Community Edition 2020.2.1\lib\idea_rt.jar=64698:D:\software\IntelliJ IDEA Community Edition 2020.2.1\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\seeta\.m2\wrapper\dists\apache-maven-3.8.1-bin\2l5mhf2pq2clrde7f7qp1rdt5m\apache-maven-3.8.1\boot\plexus-classworlds-2.6.0.jar;C:\Users\seeta\.m2\wrapper\dists\apache-maven-3.8.1-bin\2l5mhf2pq2clrde7f7qp1rdt5m\apache-maven-3.8.1\boot\plexus-classworlds.license org.codehaus.classworlds.Launcher -Didea.version=2020.2.1 -s C:\Users\seeta\.m2\settings.xml com.google.cloud.tools:jib-maven-plugin:2.5.0:build [INFO] Scanning for projects... [INFO] [INFO] -------------------< com.learn.fun:MySpringBootApp >-------------------- [INFO] Building MySpringBootApp 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- jib-maven-plugin:2.5.0:build (default-cli) @ MySpringBootApp --- [WARNING] 'mainClass' configured in 'maven-jar-plugin' is not a valid Java class: ${start-class} [INFO] [INFO] Containerizing application to registry.hub.docker.com/seetaramao/my-demos/springboot-jim-image... [WARNING] Base image 'gcr.io/distroless/java:11' does not use a specific image digest - build may not be reproducible [INFO] Executing tasks: [INFO] [ ] 0.0% complete [INFO] > building image to registry [INFO] [INFO] [INFO] Executing tasks: [INFO] [ ] 0.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] [INFO] [INFO] Using credentials from <to><auth> for registry.hub.docker.com/seetaramao/my-demos/springboot-jim-image [INFO] Executing tasks: [INFO] [ ] 0.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] [INFO] [INFO] Executing tasks: [INFO] [== ] 5.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] [INFO] [INFO] Executing tasks: [INFO] [== ] 5.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] [INFO] [INFO] Executing tasks: [INFO] [== ] 5.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] > launching application layer builders [INFO] [INFO] [INFO] Executing tasks: [INFO] [== ] 5.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] > building dependencies layer [INFO] [INFO] [INFO] Executing tasks: [INFO] [== ] 5.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] > building dependencies layer [INFO] > building resources layer [INFO] [INFO] [INFO] Executing tasks: [INFO] [== ] 5.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] > building dependencies layer [INFO] > building resources layer [INFO] > building classes layer [INFO] [INFO] [INFO] Executing tasks: [INFO] [==== ] 11.7% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] > building classes layer [INFO] [INFO] [INFO] Executing tasks: [INFO] [==== ] 11.7% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] > building classes layer [INFO] [INFO] [INFO] Executing tasks: [INFO] [===== ] 15.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] [INFO] [INFO] Using base image with digest: sha256:ae5d32ed4da6d2207fd34accde64f5b1264cbdd1340fa8c1cfa70cdf1841f9db [INFO] Executing tasks: [INFO] [===== ] 15.0% complete [INFO] > authenticating push to registry.hub.docker.com [INFO] > pulling base image manifest [INFO] [INFO] [INFO] Executing tasks: [INFO] [====== ] 20.0% complete [INFO] > pulling base image manifest [INFO] [INFO] [INFO] Executing tasks: [INFO] [====== ] 20.0% complete [INFO] > pulling base image manifest [INFO] > launching layer pushers [INFO] [INFO] [INFO] Executing tasks: [INFO] [====== ] 20.0% complete [INFO] > pulling base image manifest [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] [INFO] [INFO] Executing tasks: [INFO] [====== ] 20.0% complete [INFO] > pulling base image manifest [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] [INFO] [INFO] Executing tasks: [INFO] [====== ] 20.0% complete [INFO] > pulling base image manifest [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] [INFO] [INFO] Executing tasks: [INFO] [====== ] 20.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > pull container configuration sha256:3ed3813dd... [INFO] [INFO] [INFO] Executing tasks: [INFO] [======== ] 25.0% complete [INFO] > pulling base image manifest [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] [INFO] [INFO] Executing tasks: [INFO] [========= ] 30.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] [INFO] [INFO] Executing tasks: [INFO] [========= ] 30.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > launching base image layer pullers [INFO] [INFO] [INFO] Executing tasks: [INFO] [========= ] 30.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] [INFO] [INFO] Executing tasks: [INFO] [========= ] 30.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] [INFO] [INFO] Executing tasks: [INFO] [========= ] 30.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] [INFO] [INFO] Executing tasks: [INFO] [========= ] 30.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] > launching layer pushers [INFO] [INFO] [INFO] Executing tasks: [INFO] [========= ] 30.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:4793b7ec2a60... [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [INFO] [INFO] Executing tasks: [INFO] [========= ] 30.0% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:85a347d81365678fa4da2ec69... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:4793b7ec2a60... [INFO] [INFO] [INFO] Executing tasks: [INFO] [========== ] 33.3% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > pushing blob sha256:bd3ec8eb1401e1fb1475f1c42... [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:4793b7ec2a60... [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [INFO] [INFO] Executing tasks: [INFO] [=========== ] 36.7% complete [INFO] > pushing blob sha256:4e46f6a03803e74c63e8e3b03... [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:4793b7ec2a60... [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [INFO] [INFO] Executing tasks: [INFO] [============ ] 40.0% complete [INFO] > checking base image layer sha256:5dea5ec2316d... [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:4793b7ec2a60... [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [INFO] [INFO] Executing tasks: [INFO] [============= ] 42.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > checking base image layer sha256:bb771d6dc9a1... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:4793b7ec2a60... [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [INFO] [INFO] Executing tasks: [INFO] [============= ] 44.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:4793b7ec2a60... [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [INFO] [INFO] Executing tasks: [INFO] [============== ] 46.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [ERROR] [ERROR] I/O error for image [registry.hub.docker.com/seetaramao/my-demos/springboot-jim-image]: [INFO] Executing tasks: [INFO] [============== ] 46.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [ERROR] [ERROR] I/O error for image [registry.hub.docker.com/seetaramao/my-demos/springboot-jim-image]: [INFO] Executing tasks: [INFO] [============== ] 46.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [ERROR] [ERROR] javax.net.ssl.SSLException [INFO] Executing tasks: [INFO] [============== ] 46.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [ERROR] [ERROR] javax.net.ssl.SSLException [INFO] Executing tasks: [INFO] [============== ] 46.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [ERROR] [ERROR] Socket closed [INFO] Executing tasks: [INFO] [============== ] 46.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [ERROR] [ERROR] Socket closed [INFO] Executing tasks: [INFO] [============== ] 46.0% complete [INFO] > checking base image layer sha256:6f78ac1091ad... [INFO] > launching layer pushers [INFO] > checking base image layer sha256:6ff225fd7066... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.939 s [INFO] Finished at: 2021-06-13T07:56:05-04:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.5.0:build (default-cli) on project MySpringBootApp: Build image failed, perhaps you should make sure your credentials for 'registry.hub.docker.com/seetaramao/my-demos/springboot-jim-image' 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.hub.docker.com/seetaramao/my-demos/springboot-jim-image: 401 Unauthorized -> [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
Additional Information:
settings.xml <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository/> <interactiveMode/> <offline/> <pluginGroups/> <servers> <server> <id>registry.hub.docker.com</id> <username>seetaramao</username> <password>*****</password> </server> </servers> <mirrors/> <proxies/> <profiles/> <activeProfiles/> </settings>
thanks for you help, I tried everything to make this possible , you are right openJdk is a publci no need for username and password
I only added
` <image>gcr.io/distroless/java:11</image>
`
and in the To section I added by requistery
`to>
</to>`
Environment:
Description of the issue: Getting authorization error while pushing build to docker hub.
Expected behavior: Docker image should be available in docker hub
Steps to reproduce:
jib-maven-plugin
Configuration:Log output:
Additional Information: