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.

Cannot pull nginx. Unauthorized for registry-1.docker.io/library/nginx: 401 Unauthorized

See original GitHub issue

Environment:

  • *Jib version: 1.6.1
  • *Build tool: Maven
  • *OS: CentOS (Building maven on Jenkins)

Description of the issue:

Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.6.1:build (default-cli) on project remoteportal.client: Build image failed, perhaps you should make sure your credentials for 'registry-1.docker.io/library/nginx' 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-1.docker.io/library/nginx: 401 Unauthorized

Expected behavior: It should pull the public image without needing authorisation.

Steps to reproduce:

  1. I’m running this on a centOS instance with Jenkins pipeline.
  2. It works on local (Docker for Mac)
  3. It worked for me a week back, because I have an image of this app in ECR.

jib-maven-plugin Configuration:

<plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <configuration>
                    <from>
                        <image>nginx</image>
                    </from>
                    <to>
                        <image>${ecrEndpoint}/frontend-${docker-artifact-id}</image>
                        <tags>
                            <tag>${project.version}</tag>
                        </tags>
                    </to>
                    <container>
                        <ports>
                            <port>80</port>
                            <port>443</port>
                        </ports>
                        <entrypoint>
                            <command>nginx</command>
                            <arg>-g</arg>
                            <arg>daemon off;</arg>
                        </entrypoint>
                    </container>
                    <extraDirectories>
                        <paths>${project.build.directory}/it-temp/frontend-dist/</paths>
                    </extraDirectories>
                    <skip>false</skip>
                </configuration>
            </plugin>

Log output:

Additional Information: I’m running the mvn jib:build in the Jenkins pipeline.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
nikhileshvacommented, Nov 13, 2019

@chanseokoh Yeah, it was a mistake from our end. The picked up credentials were wrong. We had thought there are no credentials on the server, but somehow there were some present. It’s working fine without any credentials.

1reaction
chanseokohcommented, Oct 18, 2019

I understand, but I think we’re good with trying to be automatic. This is also similar to how the Docker CLI works. Actually, it is only this issue that is potentially affected, but even so, it is not confirmed yet. Others were due to different reasons. And we have opened #2056, so once that is fixed, this will become clear.

But if we see more people wanting to explicitly disable using any credentials, we could potentially introduce a flag like doNotUseAnyCredentials. However, it doesn’t look like people will use such a flag a lot, but we’ll see.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker login 401 Unauthorized, external registry - GitLab Forum
I can't get docker login to work correctly with gitlab and a registry using docker-compose. When I log in with a wrong password...
Read more >
Kubernetes ImagePullBackOff: Troubleshooting With Examples
One such error is ImagePullBackOff. It typically shows up when the kubelet agent instructs the container runtime and can't pull the image from...
Read more >
docker unauthorized: authentication required - upon push with ...
I found out out that even if I login successfully with the docker login command, any pull failed. I tried to clean up...
Read more >
Failed with status: 401 Unauthorized - DockerEngine
Hi, I am getting the following error on the logs when trying to run/pull hello-world msg="Handler for POST /v1.23/containers/create returned ...
Read more >
ERROR [internal] load metadata for docker.io - You.com
failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: failed to fetch oauth token: unexpected status: 401...
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