question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

502 Bad Gateway on Centos 8

See original GitHub issue

Is there something special we have to do to get it running on Centos 8?

I tried to run the basic docker-compose.yaml example from README

version: '2'

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

  whoami:
    image: jwilder/whoami
    environment:
      - VIRTUAL_HOST=whoami.local

And I got:

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.19.3</center>
</body>
</html>

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
buchdagcommented, Apr 28, 2021

I usually create a separate Docker network outside of Docker compose then use it as an external network in the compose file.

docker network create nginx-proxy

then

version: '3'

services:
  nginx:
    [...]
    networks:
      - nginx-proxy

# Do not forget to 'docker network create nginx-proxy' before launch
# and to connect the proxied containers to the nginx-proxy network.

networks:
  nginx-proxy:
    external: true

Repeated in every compose file for services that will be proxied.

Also take a look at https://github.com/buchdag/letsencrypt-nginx-proxy-companion-compose

0reactions
nickv2002commented, Apr 28, 2021

Are you certain the mylar.local container is sharing a network with the nginx-proxy (or docker-gen if you use a two container setup) container ?

docker inspect --format='{{.NetworkSettings.Networks}}' yournginxproxycontainer
docker inspect --format='{{.NetworkSettings.Networks}}' mylar.localcontainer

Ahh so they’re on different networks… hmm. Must be related to having different docker-compose stacks for them in my case.

nick@uzfs:~$ docker inspect --format='{{.NetworkSettings.Networks}}' 6f745d600817
map[bridge:0xc000535b00]
nick@uzfs:~$ docker inspect --format='{{.NetworkSettings.Networks}}' 4f3c9e8cd81e
map[compose_default:0xc000576000]

Thanks for you help debugging that. I’ll work on figuring out how to bridge that networking unless you have any tips offhand.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix '502 Bad Gateway' Error In Nginx | LinuxHostSupport
The 502 Bad Gateway error is an HTTP status code that means that one server received an invalid response from another server.
Read more >
Solved: Centos 8 - 502 Bad Gateway - Alfresco Hub
I loaded Alfresco on a Centos 8 server yesterday using the docker-compose method and after the install I could not get to the...
Read more >
How To Fix a 502 Bad Gateway Error - Kinsta
The 502 (Bad Gateway) status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an...
Read more >
Docker and firewalld causing 502 Bad Gateway - Reddit
Docker and firewalld causing 502 Bad Gateway Error on CentOs 8 ... Can't get docker to work with my firewall because it blocks...
Read more >
How to Fix 502 Bad Gateway Error - Hostinger
The 502 Bad Gateway error indicates that the server which you're connecting to received an invalid response. When accessing a URL, your browser ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found