title: How to proxy_pass to a node docker container on port 80 with nginx container
body: <p>In short, I'm trying to set up an nginx container to proxy_pass to other containers on port 80.</p>
  
  <p>I was following along with this tutorial: <a href="https://dev.to/domysee/setting-up-a-reverse-proxy-with-nginx-and-docker-compose-29jg" rel="nofollow noreferrer">https://dev.to/domysee/setting-up-a-reverse-proxy-with-nginx-and-docker-compose-29jg</a> </p>
  
  <p>They describe having a docker compose file that looks something like:</p>
  
  <pre><code>version: '3'
  services:
    nginx: 
      image: nginx:latest
      container_name: production_nginx
      volumes:
        - ./nginx.conf:/etc/nginx/nginx.conf
        - ./nginx/error.log:/etc/nginx/error_log.log
        - ./nginx/cache/:/etc/nginx/cache
        - /etc/letsencrypt/:/etc/letsencrypt/
      ports:
        - 80:80
        - 443:443
  
    your_app_1:
      image: your_app_1_image:latest
      container_name: your_app_1
      expose:
        - "80"
  
    your_app_2:
      image: your_app_2_image:latest
      container_name: your_app_2
      expose:
        - "80"
  
    your_app_3:
      image: your_app_3_image:latest
      container_name: your_app_3
      expose:
        - "80"
  </code></pre>
  
  <p>Then in the nginx config they do a proxy_pass based on the path like this:</p>
  
  <pre><code>proxy_pass http://your_app_1:80;
  </code></pre>
  
  <p>This all makes sense to me, however when I was making a test node server to listen on port 80, I'm getting the error: Error: listen EACCES: permission denied 0.0.0.0:80. In my Dockerfile for the node server, I'm using a different user:</p>
  
  <pre><code>USER node
  </code></pre>
  
  <p>I know I'm getting this error because non root users are not supposed to be able to bind below port 1024 or something. And I know it's bad practice to run as root in a container... so how in the world is something like this possible? I feel like I'm missing something here. It would be nice to not have to remember some custom high port your server is running on every time you do a proxy_pass in nginx... or is that just a fact of life?</p>