title: Docker-compose and nginx proxy
body: <p>I am trying to use <strong>jwilder/nginx-proxy</strong> as a reverse proxy for my angular2 app that is broken down into 3 containers (angular, express and database). </p>
  
  <p>I have tried different configurations to proxy requests to my app on port 80, however when I try to run docker-compose I get : </p>
  
  <pre><code>ERROR: for angular  Cannot start service angular: driver failed programming 
  external connectivity on endpoint example_angular_1
  (335ce6d0c775b7837eb436fff97bbb56bfdcaece22d51049e1eb4bf5ce45553c): Bind for 
  0.0.0.0:80 failed: port is already allocated
  </code></pre>
  
  <p>While the message is pretty clear that there is a conflict on port 80, I cannot figure out a way to go around it, it works just fine when I set my angular container to work on port 4200 but then I have to specify the port number in url every time I want to visit the page. I am using the reverse proxy because it is not the only app that will be running in my environment</p>
  
  <p>Below is my <strong>docker-compose.yml</strong></p>
  
  <pre><code>version: '3'
  
  services:
      nginx-proxy:
          image: jwilder/nginx-proxy
          container_name: nginx-proxy
          ports: - "80:80"
          volumes: - /var/run/docker.sock:/tmp/docker.sock:ro
  
      angular:
          build: client
          ports: - "80"
          environment:
              - VIRTUAL_HOST=example.com
              - VIRTUAL_PORT=80
          restart: always
  
       express:
           build: server
           ports: - "3000:3000"
           links: - database
           restart: always
  
       database:
           image: mongo
           ports: - "27017:27017"
           restart: always
  
  networks:
    default:
     external:
       name: nginx-proxy
  </code></pre>
  
  <p>And <strong>Dockerfile</strong> for the angular container</p>
  
  <pre><code>FROM node:8-alpine as builder
  
  COPY package.json package-lock.json ./
  
  RUN npm set progress=false &amp;&amp; npm config set depth 0 &amp;&amp; npm cache clean --force
  
  RUN npm i &amp;&amp; mkdir /ng-app &amp;&amp; cp -R ./node_modules ./ng-app
  
  WORKDIR /ng-app
  
  COPY . .
  
  RUN $(npm bin)/ng build --prod --build-optimizer
  
  FROM nginx:1.13.3-alpine
  
  COPY nginx/default.conf /etc/nginx/conf.d/
  
  RUN rm -rf /usr/share/nginx/html/*
  
  COPY --from=builder /ng-app/dist /usr/share/nginx/html
  
  CMD ["nginx", "-g", "daemon off;"]
  
  EXPOSE 80
  </code></pre>