Not clear about how to set up credential for docker.io in maven
See original GitHub issueDescription of the issue: Not able to build the docker image because of authentication.
Expected behavior: (1) credential should be picked up by the plugin and then it’s able to build the docker image which will be auto pushed to docker.io (2) how if I only want to build the docker image locally without auto push Steps to reproduce: mvn clean compile jib:build
Environment:
Mac OS
Apache Maven 3.5.4
jib-maven-plugin
Configuration:
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>0.9.2</version>
<configuration>
<from>
<image>openjdk:alpine</image>
</from>
<to>
<image>registry.hub.docker.com/{my-username}/image-built-with-jib</image>
</to>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
maven settings
Configuration:
<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>${user.home}/.m2/my-repository</localRepository>
<servers>
<server>
<id>registry.hub.docker.com</id>
<username>{username}</username>
<password>{password}</password>
</server>
</servers>
</settings>
Log output: [ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.2:build (default) on project demo: Build image failed, perhaps you should make sure your credentials for ‘registry.hub.docker.com’ are set up correctly: com.google.api.client.http.HttpResponseException: 401 Unauthorized [ERROR] {“errors”:[{“code”:“UNAUTHORIZED”,“message”:“authentication required”,“detail”:[{“Type”:“repository”,“Class”:“”,“Name”:“library/openjdk”,“Action”:“pull”}]}]}
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (7 by maintainers)
Top GitHub Comments
@coollog It works 😃 Thanks.
Thanks @coollog . This is to update 0.9.4 fixed ‘401 unauthorized’ issue, all works fine for now.