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.

AWS ECR with jib.to.auth.username does not work

See original GitHub issue

Environment:

  • Jib version: 2.4.0
  • Build tool: maven 3.6.3
  • OS: MacOs

Description of the issue:

Running the command: mvn compile com.google.cloud.tools:jib-maven-plugin:2.4.0:build Djib.to.auth.username=${AWS_ECR_KEY_USER} -Djib.to.auth.password=${AWS_ECR_SECRET} -Dimage=<MY IMAGE> does not work and I get a 401 from the ECR registry

Expected behavior: Should build

Steps to reproduce: Create a mvn project with :

<build>
<plugins>
    <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>jib-maven-plugin</artifactId>
        <version>${jib.version}</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>build</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <from>
                <image>gcr.io/distroless/java:8</image>
            </from>
            <to>
                <image>
                    imageURI:/${project.artifactId}:${project.version}
                </image>
                <tags>latest</tags>
            </to>
        </configuration>
    </plugin>
</plugins>
</build>

Log output: 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 forimageURI: 401 Unauthorized -> [Help 1]

AWS_ECR_KEY_USER and AWS_ECR_SECRET are my aws credentials this seems not to work. If I don’t pass the -Djib.to.auth.username it will grab it from amazon-ecr-credential-helper which in my case works and the credentials are the same. That’s why I think this is a bug.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
chanseokohcommented, Oct 12, 2020

For those coming to this thread, see https://serverfault.com/questions/1004915/what-is-the-proper-way-to-log-in-to-ecr and #2628 to understand the issue. However, we recommend using a credential helper instead of jib.to.auth. For a solution for GitHub Actions, see https://github.com/GoogleContainerTools/jib/issues/2627#issuecomment-663872634.

Also, this Stack Overflow answer gives a more in-depth explanation on how registries accept credentials from registry clients (including Jib).

1reaction
jomachcommented, Jul 25, 2020

Then let’s close this. PS: Thanks for the extreme quick feedback !

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker - Jib: how to use amazon-ecr-credential-helper without ...
Any credential helper will output a username and a password with the "get" command. For example with Google Container Registry, $ docker- ...
Read more >
Troubleshooting errors with Docker commands when using ...
In some cases, running a Docker command against Amazon ECR may result in an error message. Some common error messages and potential solutions...
Read more >
google/jib - Gitter
Hi,. Currently i am trying to use jib maven plugin in my application pom and i want to push image to AWS ECR....
Read more >
Authentication methods | Container Registry documentation
Log in to gcloud as the user that will run Docker commands. To configure authentication with user credentials, run the following command: gcloud...
Read more >
How to Build and Push Docker Images to AWS ECR
Well, Docker was created to solve this very problem. image-166 image source: internet. In this article, we will cover four major concepts: How ......
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