"no basic auth credentials" while pulling image or doing docker-compose for images from a private Nexus repository
Asked Answered
H

2

29

I wanted to put the question and its resolution here as I encountered this issue while pulling an image from a private Nexus repository and I wasn't able to find a clear solution.

Issue:

I have an access to a private Nexus repository which I was able to validate but going to the Nexus repo portal and signing into it. I have installed Docker on my mac and try to pull an image from the above Nexus repo portal.

Something like the below (where redis-dev1 is the image name in the repo)

docker pull nexusrepo.domain.com:8343/redis-dev1 

When I do that : I get the following error:

Error response from daemon: Get https://nexusrepo.domain.com:8343/redis-dev1/manifests/1:
no basic auth credentials
Harmonica answered 7/1, 2020 at 19:30 Comment(0)
H
43

Resolution:

The Trick is to : set/configure our local docker to use the remote repo.

Usually to test our local docker, we use some sort of local repo.

But here we are trying to connect our local docker to an external repo. So we have to do a docker login so that local docker will be configured to use that repo.

Before doing the docker pull, I did a docker login to the nexus repo using the below command.

$ docker login nexusrepo.domain.com:8343 --username <nexusrepo-username> --password <nexusrepo-password>

This gave me

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded

After this I retried the docker pull command and the image got downloaded.

$ docker pull nexusrepo.domain.com:8343/redis-dev1
1: Pulling from redis-dev1
a3edc43aeb02: Pull complete 
e3238738e1ef: Pull complete 
d4cf32a6f41d: Pull complete 
0c23342da3f1: Pull complete 
7f0e234e3192: Pull complete 
4411116da4fd: Pull complete 
557a23268824: Pull complete 
3cd234e1b6e8: Pull complete 
Digest: sha256:7bc1 .... 
Status: Downloaded newer image for nexusrepo.domain.com:8343/redis-dev1
nexusrepo.domain.com:8343/redis-dev1

Now local docker repo is set to use the remote repo. This can be done for any external repo.

Hope this helps folks in the same bucket as I was :)

Harmonica answered 7/1, 2020 at 19:30 Comment(4)
See docs.github.com/en/packages/learn-github-packages/…Holds
Don't use --password and it will asked then.Amiens
Excellent answer. This worked.Solder
I am able to successfully docker login to our private repo, and still get the "no basic auth credentials" error when trying to pull an image. Is this a configuration issue on the server side?Trishtrisha
E
0

This worked, I used

docker login <address> --username <username>

without --password as Jekis mentioned. You will get the message:

WARNING! Your password will be stored unencrypted in /home/user/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credential-stores

It doesn't store the password in plain text, though. So I'm not sure whether or not you should care about this warning.

Exercitation answered 24/7 at 7:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.