title: Docker composed services can't communicate by service name
body: <p>tldr: I can't communicate with a docker composed service by its service name in order to make requests to an api running in networked containers.</p>
  
  <p>I have a single page application that makes requests to a json api. Its Dockerfile looks like this:</p>
  
  <pre><code>FROM nginx:alpine
  COPY dist /usr/share/nginx/html
  EXPOSE 80
  </code></pre>
  
  <p>A build process does it's thing and puts all the static assets in a dist directory which is then copied to the html directory of the nginx web server.</p>
  
  <p>I have a mock json api powered by json-server. Its Dockerfile looks like this:</p>
  
  <pre><code>FROM node:7.10.0-alpine
  
  RUN mkdir -p /usr/src/app
  WORKDIR /usr/src/app
  
  COPY package.json /usr/src/app/
  RUN npm install
  
  COPY . /usr/src/app
  
  EXPOSE 3000
  
  CMD [ "npm", "start" ]
  </code></pre>
  
  <p>I have a docker-compose file that looks like this:</p>
  
  <pre><code>version: '2'
  
  services:
    badass-ui:
      image: mydocker-hub/badass-ui
      container_name: badass-ui
      ports:
        - "80:80"
  
    badderer-api:
      image: mydocker-hub/badderer-api
      container_name: badderer-api
      ports:
        - "3000:3000"
  </code></pre>
  
  <p>I'm able to build both containers successfully, and am able to run "docker-compose up" with both containers running smoothly. Fetch requests from badass-ui to badderer-api:3000/users returns "net::ERR_NAME_NOT_RESOLVED". Fetch requests to <a href="http://192.168.99.100:3000/users" rel="nofollow noreferrer">http://192.168.99.100:3000/users</a> (or whatever the container IP may be) work fine. I thought by using docker compose I would be able to reference the name of a service defined in docker-compose.yml as a domain name, and that would enable communication between the containers via domain name. This doesn't seem to work. Is there something wrong with my docker-compose.yml? I'm on Windows 10 Home edition, using the tools that come with the Docker Quickstart terminal for Windows. I'm using docker-compose version 1.13.0, docker version 17.05.0-ce, docker-machine version 0.11.0 and VirtualBox 5.1.20.</p>