Help setting up the HTTP Connector for Docker Proxy

I deployed nexus3(3.69.0-02) container by docker image (sonatype/nexus3), then I set up a docker proxy repository.
I referred to some online tutorials about reverse-proxy setting by nginx, the nginx server config is :

server {
  listen 80;
  server_name local.nexus.com;

  location / {
          proxy_pass http://{my_nexus3_container}:8081/repository/{my_docker_proxy_repository}/$request_uri;
          proxy_set_header Host $host;
          proxy_http_version 1.1;
          proxy_set_header X-Forwarded-For $remote_addr;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_connect_timeout 60s;
          proxy_send_timeout 60s;
          proxy_read_timeout 300s;
          send_timeout 60s;
          proxy_buffers 16 32k;
          proxy_buffer_size 64k;
          proxy_set_header Connection "";
   }
}

and my docker daemon.json setting is :

{
    "registry-mirrors":[
        "http://local.nexus.com:80"
    ],
    "insecure-registries":[
        "local.nexus.com:80"
    ]

The local.nexus.com has pointed to 127.0.0.1.

Then I try to run this command and I found it is work !

docker pull local.nexus.com/busybox

(At the same time, I also found that command docker pull busybox not work, I try to analysis it by tcpdump and I found it try to pull form “registry-1.docker.io”, not my proxy setting. I don’t known why, but it isn’t main question in this asking.)

The Main Question Start From Here:

The reverse proxy of nginx is not a direct access, so I try the “Repository Connectors” which the setting in docker proxy repository.
I set my docker proxy repository http connectors is 8083, and expose the 8083 port of the container, and then change the daemon.json to :

{
    "registry-mirrors":[
        "http://local.nexus.com:8083"
    ],
    "insecure-registries":[
        "local.nexus.com:8083"
    ]

I try to run docker pull local.nexus.com:8083/busybox , but it doesn’t work!

It printed some html code, and the main of conent maybe is :

<div class="nexus-body">
  <div class="content-header">
    <img src="../../../../../static/rapture/resources/icons/x32/exclamation.png?3.69.0-02" alt="Exclamation point" aria-role="presentation"/>
    <span class="title">Error 404</span>
    <span class="description">Not Found</span>
  </div>
  <div class="content-body">
    <div class="content-section">
      Not Found
    </div>
  </div>
</div>

Error 404? I try to find the reason then I think it may be cause by not found the repository. The helper document in here seem to talk about that, the third method “Using port connectors” is my want to do, but is just talk about the ssl and https not http.

So, how can I use the docker proxy repository by HTTP Connector? What are the right setps?

Read this article
https://help.sonatype.com/en/docker-repository-reverse-proxy-strategies.html
May it`s help to you.
main steps

  1. make docker group repo
    1.1 put your proxy docker repo in group
  2. location in nginx config is “/v1” and “v2”
    and points to your group docker repo

I knwo the group docker, however, proxy docker has HTTP Connector setting, is there a right way to use it?

And you should know, the nginx config doesn’t must be configed the “/v1” and “v2”. The important point is the proxy_pass url is 8081 port (nexus default port) and the path of uri is the right way to the repo( proxy repo or group repo are OK)