title: Docker Nginx: host not found in upstream
body: <p>I have my docker app running in the aws EC2 instance, and I am currently trying to map the app to the external IP address using Nginx. Here is a snap shot of the containers that I have running:</p>
  
  <p><a href="https://i.stack.imgur.com/F1H7i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F1H7i.png" alt="enter image description here"></a></p>
  
  <p>My test-app is a fairly simple app that displays a static html website. And I deployed it using the following command:</p>
  
  <p><code>docker run -d --name=test-app test-app</code></p>
  
  <p>The nginx-proxy has the following <em>proxy.conf</em></p>
  
  <pre><code>server {
    listen 80;
    location / {
      proxy_pass http://test-app;
    }
  }
  </code></pre>
  
  <p>Here is the Dockerfile for the nginx proxy:</p>
  
  <pre><code>FROM nginx:alpine
  
  RUN rm /etc/nginx/conf.d/*
  
  COPY proxy.conf /etc/nginx/conf.d/
  
  </code></pre>
  
  <p>nginx-proxy is run using the following command:
  <code>docker run -d -p 80:80 --name=nginx-proxy nginx-proxy</code></p>
  
  <p>However, the nginx container never runs, and here the error log I get</p>
  
  <pre><code>2020/03/27 15:55:19 [emerg] 1#1: host not found in upstream "test-app" in /etc/nginx/conf.d/proxy.conf:5
  nginx: [emerg] host not found in upstream "test-app" in /etc/nginx/conf.d/proxy.conf:5
  </code></pre>