0

I have a basic docker-compose stack that runs multiple containers behind a reverse proxy (nginx, runs as container in same stack). I need to run a second instance of one of those containers in the stack, so I cloned it and gave the clone container a different container name, config folder, database and port in docker-compose.yml. In nginx.conf I cloned the server {} stanza for the original container and changed the port to reflect the port of the clone container.

After spinning up the stack and accessing the clone container via it's web UI and custom port it appears to work successfully (http://192.168.1.10:5151). The problem is, now when trying to access the original container via it's web UI and original port (http://192.168.1.10:5050) it instead points me to the clone container's web UI (http://192.168.1.10:5151). Why is this occurring and how do I troubleshoot?

Here's the pertinent stanzas in nginx.conf:

  server {
    listen 5050;
    server_name dusty-rhodes;
    location / {
      proxy_pass http://wireguard-vpn:5050;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
    }
  }

  server {
    listen 5151;
    server_name dusty-crophopper;
    location / {
      proxy_pass http://wireguard-vpn:5151;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
    }
  }
crashintoty
  • 363
  • 1
  • 2
  • 13
  • Can't help you directly with your setup... Is it a real redirect to the other port, or is just the same content shown? And did you have a look into docker swarm? It's exactly doing what you try - replicating containers. https://docs.docker.com/engine/swarm/ – Geilmaker Jul 19 '23 at 13:40

0 Answers0