Trouble connecting to Docker registry stored on Ne

2019-07-09 04:16发布

问题:

Basically I'm having trouble connecting to a docker registry I'm trying to make using the latest Nexus preview. First I installed Sonotype Nexus 3 Preview on a MS Azure cloud server running Ubuntu 14.04 trusty. Lets call this location

my-azure-site.cloudapp.net:8443/nexus to get to the Nexus UI. I am using this guide from start to finish - https://books.sonatype.com/nexus-book/3.0/reference/index.html

So I know the only way to connect to a remote Docker repo is through SSL so I enabled HTTPS in nexus as shown by using the 8443 port. I then created a Docker proxy repo named docker-hub to be able to pull images from the Docker Central Hub as outlined in section 8.3 of the guide. Nexus is showing that repo has a URL of

https://my-azure-site.cloudapp.net:8443/nexus/repository/docker-hub/

Then I created a private hosted repo called docker-mySoftware with a HTTPS docker connector port of 18444 as outlined in section 8.4 of the guide and Nexus is showing the URL as

https://my-azure-site.cloudapp.net:8443/nexus/repository/docker-mySoftware/

Then I created a group repo named docker-all that contains the above 2 with a HTTPS docker connector port of 18443 as outlined in section 8.5 of the guide and Nexus is showing the URL as

https://my-azure-site.cloudapp.net:8443/nexus/repository/docker-all/

At first when I tried to run the following as outlined in section 8.7 to test out the proxy using my local docker client also running ubuntu on my physical laptop

sudo docker search my-azure-site.cloudapp.net:18443/postgres

I got something saying there is a ca certificate for my-azure-site.net:18443 but not for my-azure-site.cloudapp.net:18443 so I recreated the certificate using keytool to include the cloudapp part. Now when I retried it I'm getting

Error response from daemon: Unexpected status code 404

By the way I forgot to mention I opened up ports 18444 and 18443 on the Azure console beforehand.

I tried recreating the repos, reindexing proxy repo, recreating certificates on the nexus azure cloud, using

sudo docker -d --insecure-registry my-azure-site.cloudapp.net:18443 on my docker client machine to hopefully get around all this certification stuff but still no luck. I tried different combinations of the URL such as

sudo docker search my-azure-site.cloudapp.net:18443/nexus/postgres and https://my-azure-site.cloudapp.net:8443/nexus/repository/docker-all/nexus etc.

回答1:

As you correctly identified setting the context-path caused the problem. This turned out to be a bug and it has been fixed now. The next release of Nexus 3 (Milestone 6) will include that fix and allow you to use the context path.

However keep in mind that the context path will not be part of the URLs for Docker, since the docker registry format and therefore also the docker client do NOT support context paths. So for Docker specific usage you will continue to use the ports as documented.

Update: The milestone 6 version has been released and contains the relevant fix.



回答2:

So basically it means for each different repository you want to host you will need to have a different port configured ? This is not very clean, specially in the image names.