title: Docker Networking - nginx: [emerg] host not found in upstream
body: <p>I have recently started migrating to Docker 1.9 and Docker-Compose 1.5's networking features to replace using links.</p>
  
  <p>So far with links there were no problems with nginx connecting to my php5-fpm fastcgi server located in a different server in one group via docker-compose. Newly though when I run <code>docker-compose --x-networking up</code> my php-fpm, mongo and nginx containers boot up, however nginx quits straight away with <code>[emerg] 1#1: host not found in upstream "waapi_php_1" in /etc/nginx/conf.d/default.conf:16</code></p>
  
  <p>However, if I run the docker-compose command again while the php and mongo containers are running (nginx exited), nginx starts and works fine from then on.</p>
  
  <p>This is my <code>docker-compose.yml</code> file:</p>
  
  <pre><code>nginx:
    image: nginx
    ports:
      - "42080:80"
    volumes:
      - ./config/docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
  
  php:
    build: config/docker/php
    ports:
      - "42022:22"
    volumes:
      - .:/var/www/html
    env_file: config/docker/php/.env.development
  
  mongo:
    image: mongo
    ports:
      - "42017:27017"
    volumes:
      - /var/mongodata/wa-api:/data/db
    command: --smallfiles
  </code></pre>
  
  <p>This is my <code>default.conf</code> for nginx:</p>
  
  <pre><code>server {
      listen  80;
  
      root /var/www/test;
  
      error_log /dev/stdout debug;
      access_log /dev/stdout;
  
      location / {
          # try to serve file directly, fallback to app.php
          try_files $uri /index.php$is_args$args;
      }
  
      location ~ ^/.+\.php(/|$) {
          # Referencing the php service host (Docker)
          fastcgi_pass waapi_php_1:9000;
  
          fastcgi_split_path_info ^(.+\.php)(/.*)$;
          include fastcgi_params;
  
          # We must reference the document_root of the external server ourselves here.
          fastcgi_param SCRIPT_FILENAME /var/www/html/public$fastcgi_script_name;
  
          fastcgi_param HTTPS off;
      }
  }
  </code></pre>
  
  <p>How can I get nginx to work with only a single docker-compose call?</p>