3

I am using NGINX container to redirect certain requests to another container.While running docker-compose up -d , i am getting bellow error.

" 2019/09/26 18:05:00 [emerg] 1#1: host not found in upstream "abcplus-visualize:61613" in /etc/nginx/nginx.conf:10 nginx: [emerg] host not found in upstream "abcplus-visualize:61613" in /etc/nginx/nginx.conf:10"

below is my docker-compose.yml file

version: '2'

services:
    reverseproxy:
        image: reverseproxy
        ports:
            - 49665:2181
        restart: always

    abcplus-visualize:
        depends_on:
            - reverseproxy
        image: abcplus-visualize:latest
        restart: always

below is my nginx.conf file

worker_processes 1;

events { worker_connections 1024; }

http {

    sendfile on;

    upstream docker-abcplus {
        server abcplus-visualize:61613;
    }

    server {
        listen 2181;
        server_name localhost;

          location / {
            proxy_pass         http://docker-abcplus;
            proxy_redirect    off;
            proxy_set_header   Host $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-Host $server_name;
        }
    }
}
Bhavesh Modi
  • 303
  • 6
  • 18

2 Answers2

0

try to use :

upstream docker-abcplus {
    server abcplus-visualize:61613 max_fails=6 fail_timeout=30s;
}

I think your upstream fails too fast before the app is running

LinPy
  • 16,987
  • 4
  • 43
  • 57
0

There was issue with Server name which we are giving in upstream. I tried with abcplus-visualize instead of abcplus-visualize , its working fine. May be while starting docker-compose server name with hypen("-") it is not understating.

Bhavesh Modi
  • 303
  • 6
  • 18