title: Docker hostnames are not resolved in a custom network
body: <p>I have the following configuration in my <code>docker-composer.yml</code> file.</p>
  
  <pre><code>version: '3.3'
  services:
    service-1:
      container_name: 'service-1'
      build: './service-1'
      depends_on:
        - 'mongo'
        - 'consul'
      networks:
        backend:
          aliases:
            - service-1
    service-2:
      build: './service-2'
      ports:
        - '8825:8825'
        - '8835:8835'
      networks:
        frontend:
        backend:
          aliases:
            - service-2
      depends_on:
        - 'mongo'
        - 'consul'
    consul:
      image: 'consul:latest'
      networks:
        backend:
          aliases:
            - consul
    mongo:
      image: 'mongo:latest'
      networks:
        backend:
          aliases:
            - mongo
  
  networks:
    frontend:
    backend:
      internal: true
  </code></pre>
  
  <p>When my containers start they are not able to communicate between each other using host names. 
  Most of containers use the mongo db container, but they are not able even reach it and I am getting the following error.</p>
  
  <pre><code>Error connecting to mongo : no reachable servers
  </code></pre>
  
  <p>Please help me to solve the problem, I got stuck.</p>
  
  <p>Thanks.</p>