title: Docker: multiple PHP7-FPM containers on different ports
body: <p>I am playing around with Docker for my local development environment. My setup for now is 5 containers (1 HaProxy + 2 NGINX + 2 PHP7-FPM).</p>
  
  <p>The proxy container is used to direct the request based on the url, so if I enter <code>http://project1.dev</code> it will proxy the request to the <code>project1-nginx</code> that uses <code>project1-php</code> for evaluating php. The setup is similar for <code>http://project2.dev</code>.</p>
  
  <p>Now, I am trying to wrap my head around the ports of the two php containers. The default fpm port is 9000, so both php containers cannot run on this. I am assuming the way to go here is to let both containers export port 9000 but make them 9000 and 9001 on the host?</p>
  
  <p>Something along these lines in my compose file.</p>
  
  <pre><code>project_1_php:
    ports:
      - "9000:9000"
  project_2_php:
    ports:
      - "9001:9000"
  </code></pre>
  
  <p>So, everything boots up fine, and project 1 is working, but project 2 gives me a 502. Nginx error log says </p>
  
  <pre><code>2016/01/26 14:37:05 [error] 6#6: *1 connect() failed (111: Connection refused) 
  while connecting to upstream, client: 172.17.0.9, server: code.dev, 
  request: "GET / HTTP/1.1", upstream: "fastcgi://172.17.0.4:9001"
  </code></pre>