Docker environment through nginx proxy leads to 502 Bad Gateway

I use nginx proxies to connect subdomains to various docker services. Since one of the latest image updates, I can no longer connect to my gitlab instance. I don't know if the nginx-proxy or gitlab update caused this problem. When I try to connect to gitlab.mydomain.com, I get the following errors:

  • Browser: 502 Bad Gateway. Nginx / 1.13.3
  • Nginx-proxy logs:

    nginx-proxy_1 | nginx.1 | 2017/08/14 11:44:10 [error] 39 # 39: * 1672 connect () failed (111: connection refused) when connecting to the upstream, client: 178.201.120.94, server: gitlab.mydomain.com, request: "GET / HTTP / 2.0", upstream: " https ://172.18.0.2-00-0043/", host: "gitlab.mydomain.com"

    nginx-proxy_1 | nginx.1 | gitlab.mydomain.com 178.201.120.94 - - [14 / Aug / 2017: 11: 44: 10 +0000] "GET / HTTP / 2.0" 502 575 "-" "Mozilla / 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit / 537.36 (KHTML e.g. Gecko) Chrome / 60.0.3112.90 Safari / 537.36 "

    nginx-proxy_1 | nginx.1 | 2017/08/14 11:44:11 [error] 39 # 39: * 1672 connect () failed (111: connection refused) when connecting to the upstream, client: 178.201.120.94, server: gitlab.mydomain.com, request: "GET / favicon.ico HTTP / 2.0", upstream: " https: //172.18.0.2-00-0043/favicon.ico", host: "gitlab.mydomain.com", referrer: " https: // gitlab . ***. com / "

My file is the file for the dock:

version: '2' services: nginx-proxy: image: jwilder/nginx-proxy ports: - "80:80" - "443:443" volumes: - /var/local/nginx/certs:/etc/nginx/certs - /etc/letsencrypt:/etc/letsencrypt - /var/run/docker.sock:/tmp/docker.sock:ro gitlab: image: gitlab/gitlab-ce:latest ports: - "2222:22" hostname: 'gitlab.***.com' expose: - 443 - 22 - 80 - 25 environment: - "VIRTUAL_HOST=gitlab.***.com,www.gitlab.***.com" - "VIRTUAL_PORT=443" - "VIRTUAL_PROTO=https" volumes: - "gitlab-config:/etc/gitlab" - "gitlab-log:/var/log/gitlab" - "gitlab-data:/var/opt/gitlab" - "/etc/letsencrypt:/etc/letsencrypt" 

Any ideas on this? Thanks.
Edit: Network settings from docker check gitlab:

  "NetworkSettings": { "Bridge": "", "SandboxID": "...", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "22/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "2222" } ], "25/tcp": null, "443/tcp": null, "80/tcp": null }, "SandboxKey": "/var/run/docker/netns/...", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "", "Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "MacAddress": "", "Networks": { "docker_default": { "IPAMConfig": null, "Links": null, "Aliases": [ "abb170528bcc", "gitlab" ], "NetworkID": "...", "EndpointID": "...", "Gateway": "172.18.0.1", "IPAddress": "172.18.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:12:00:02" } } } 
+5
source share
1 answer

this setting works for me, maybe you can compare it and find out what's wrong:

https://superuser.com/a/1242682/762931

Perhaps this is so: https://gitlab.com/gitlab-org/omnibus-gitlab/issues/1307

0
source

Source: https://habr.com/ru/post/1270851/


All Articles