Docker registry behind nginx reverse proxy

2019-07-14 04:23发布

I am trying to install a docker registry container behind a nginx reverse proxy on a subdirectory. I already have setup a git server with redirection like so:

location /git/ {
rewrite ^/git/(.*) /$1 break;
rewrite ^/git$ /$1 break;
proxy_pass http://localhost:4001;

It resolves all requests to /git correctly.

When I try to use the same configuration for my registry, it resolves the example.com\registry\ path correct to \ of the registry, but when I call \registry\v2 I end up at example.com\v2.

location /registry/{
rewrite ^/registry/(.*) /$1 break;
rewrite ^/registry$ /$1 break;
proxy_pass http://192.168.0.201:3004;

I have already tried to switch the rewrites on and off or change the proxy_pass url to /v2 but nothing works correct. The registry container itself works and is available at http://192.168.0.201:3004

How can I setup the registry on my site at example.com\registry\ that ist works?(including the v2 subsite?)

Software im using:

  • debian 9.3
  • nginx:1.10.3
  • docker registry:latest(should be 2.6)

0条回答
登录 后发表回答