Login to registry not working - Nginx not forwarding

GitlabCE - omnibus [14.9.5]
Selfhosted Ubuntu 20.04

Hi ,
I have a problem accessing the container registry via Docker cli. When doing a

docker login gitlab.company.tld:5050 

the response ist
unable to connect to w.x.y.z:5050. Do you need an HTTP proxy?

The request reaches the server (checked with tcpdump) but then kinda nothing happens (see log info below).
Looking for port 5050 gives me:

COMMAND    PID       USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
nginx   111035       root   11u  IPv4 55026039      0t0  TCP *:5050 (LISTEN)
nginx   111036 gitlab-www   11u  IPv4 55026039      0t0  TCP *:5050 (LISTEN)
nginx   111037 gitlab-www   11u  IPv4 55026039      0t0  TCP *:5050 (LISTEN)
nginx   111038 gitlab-www   11u  IPv4 55026039      0t0  TCP *:5050 (LISTEN)
nginx   111039 gitlab-www   11u  IPv4 55026039      0t0  TCP *:5050 (LISTEN)

So I think that the requests should get to nginx but it does not redirect/forward it to the registry service.
Here’s my gitlab.rb stuff regarding registry:

registry_external_url 'https://gitlab.company.tld:5050'
# Settings used by GitLab application
gitlab_rails['registry_enabled'] = true

# Settings used by Registry application
registry['enable'] = true
registry['dir'] = "/var/opt/gitlab/registry"
registry['log_directory'] = "/var/log/gitlab/registry"
registry['log_level'] = "info"

registry_nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.company.tld.crt"
registry_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.company.tld.key"
registry_nginx['listen_port'] =  5050 # override only if you use a reverse proxy: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#setting-the-nginx-listen-port
registry_nginx['listen_https'] = false # override only if your reverse proxy internally communicates over HTTP: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#supporting-proxied-ssl
registry_nginx['proxy_set_headers'] = {
  "Host" => "$http_host",
  "X-Forwarded-Proto" => "https",
  "X-Forwarded-Ssl" => "on"
}

I have played around a lot with these settings but nothing worked.

I don’t see anything in

/var/log/gitlab/nginx/access.log (0B - never touched since installation)
/var/log/gitlab/nginx/gitlab_registry_access.log (0B - never touched since installation)
/var/log/gitlab/nginx/gitlab_registry_error.log (0B - never touched since installation)

The only log that contains something regarding the registry is:

/var/log/gitlab/registry

It has the normal registry logs from starting/restarting gitlab.

Does anyone has an idea what the issue might be?

Thanks in advance!

Solved my Problem (not beeing able to access the registry via Docker cli) by using a seperate subdomain for the registry instead of another port.

1 Like

Thanks for sharing your solution :slight_smile: