title: Docker Compose V2 network error
body: <p>I am trying to communicate between two containers, but unable to do the same. 
  I add a service named 'server' in docker compose dependent on another service named 'endpoint'.
  I am need to pass the ip and port of 'endpoint' to 'server', and i am doing the same as below </p>
  
  <pre><code>command: -userver -e endpoint:51393
  </code></pre>
  
  <p>But now on i don't see 'endpoint' in the list of hosts using below command:</p>
  
  <pre><code>docker-compose exec server cat /etc/hosts
  </code></pre>
  
  <p>Here is output:</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.21.0.3      49f4808fa677
  </code></pre>
  
  <p>My Full docker-compose.yml file is as below:</p>
  
  <pre><code>version: '2'
  
  services:
    endpoint:
      build:
        context: .
        dockerfile: Dockerfile
      image: myimage_end:0.1
      command: -uendpoint
      ports:
        - 51393:51393
      networks:
        - internal
  
    server:
      build:
        context: .
        dockerfile: Dockerfile
      image: myimage_server:0.1
      command: -userver -e endpoint:51393
      ports:
        - 51392:51392
      depends_on:
        - endpoint
      networks:
        - internal
      volumes:
        - /local_path/dataset:/dataset
  
  networks:
    internal:
      driver: bridge
  </code></pre>