title: Docker compose fails to setup container links properly
body: <p>I recently started with Docker Compose and followed the introductions of the official docs. The first example I did (see <a href="https://docs.docker.com/compose/gettingstarted/" rel="nofollow">here</a>) defines two containers inside <em>docker-compose.yml</em> and if I understand them right, the containers are linked by default. Their .yml looks the same as mine:</p>
  
  <pre><code>version: '2'
  services:
    web:
      build: .
      ports:
      - "5000:5000"
      volumes:
      - .:/code
      depends_on:
      - redis
    redis:
     image: redis
  </code></pre>
  
  <p>However, using docker exec in order to take a look inside the running web container reveals that there's no DNS entry for redis in <em>/etc/hosts</em>. I'm also not capable of doing a ping to the redis container by name, it only works for the container's IP address. This is my /etc/hosts:</p>
  
  <pre><code>127.0.0.1       localhost
  ::1     localhost ip6-localhost ip6-loopback 
  fe00::0 ip6-localnet
  ff00::0 ip6-mcastprefix
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  172.18.0.3      e886da2c2a78
  </code></pre>
  
  <p>I've also examined the bug reports at Github, but the suggestions I found didn't work for me so far. I can exclude the possibility that is has to do with any firewall issues, since <em>firewalld</em> is not running on my host.</p>
  
  <p>Any ideas?</p>
  
  <p>My setup:</p>
  
  <ul>
  <li>Docker version 1.11.1</li>
  <li>Docker Compose version 1.7.1 </li>
  <li>OS: Ubuntu 16.04 on Oracle VirtualBox on Win7</li>
  </ul>