title: Links between containers not working with docker-compose version 2
body: <p>Linking between containers in a <em>version 2</em> docker-compose file is not working.</p>
  
  <p>Only when using the 'old' <em>version 1</em> format, I do see the link in /etc/hosts of the container.</p>
  
  <p>I have the following basic version 2 <em>docker-compose.yml</em> file.</p>
  
  <pre>
  version: '2'
  
  services:
    my-app:
      image: tomcat:8.0
      container_name: my-app1
      links:
        - my-redis
    my-redis:
      image: redis
      container_name: my-redis1
  </pre>
  
  <p>When I run the following command:</p>
  
  <pre>docker-compose up -d</pre>
  
  <p>I see that two containers are started, but <strong>no link is created</strong> in the /etc/hosts file:</p>
  
  <pre>docker exec -it my-app1 cat /etc/hosts</pre>
  
  <pre>
      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      2abb84ccada9
  </pre>
  
  <p>From 'my-app1' I can ping the other container using the IP address of 'my-redis1', but I cannot 'ping my-redis1' (based on a name).</p>
  
  <p>What could be the problem here?</p>
  
  <p>Additional information:</p>
  
  <ul>
  <li>Docker version 1.10.0, build 590d5108</li>
  <li>docker-compose version 1.6.0, build d99cad6</li>
  <li>Linux kernel: 4.3.5-300.fc23.x86_64</li>
  </ul>