Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 439
mmraj Avatar asked Jan 07 '20 19:01

mmraj


1 Answers

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 :)

like image 62
mmraj Avatar answered Nov 05 '22 06:11

mmraj