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.

Not clear about how to set up credential for docker.io in maven

See original GitHub issue

Description 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:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kuang-bytecommented, Jul 12, 2018

@coollog It works 😃 Thanks.

1reaction
maxatcncommented, Jul 12, 2018

Thanks @coollog . This is to update 0.9.4 fixed ‘401 unauthorized’ issue, all works fine for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to properly dockerize maven project with jib
> make sure your credentials for 'registry-1.docker.io/library/demo-springboot-docker-0001968' are set up correctly.
Read more >
Set up authentication for Docker | Artifact Registry ...
This page describes how to configure Docker to authenticate to Artifact Registry Docker repositories. You do not need to configure authentication for Cloud ......
Read more >
Using Docker from Maven and Maven from Docker - Codefresh
We would need to define within Codefresh how to compile the code first (using a Maven step) and then how to create the...
Read more >
docker login - Docker Documentation
Configure the credentials store ... If you are currently logged in, run docker logout to remove the credentials from the file and run...
Read more >
Troubleshooting AWS CodeBuild
Issue: When you use Maven with an AWS CodeBuild-provided Java build ... For Linux, clear the HTTP_PROXY and HTTPS_PROXY settings in your Docker...
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