title: docker-compose node application cannot connect internet
body: <p>I am having an issue with docker-compose containers. There is certainly an answer somewhere but it seems I don't have the vocabulary necessary to find it, sorry.</p>
  
  <p>Here is my docker-compose file :</p>
  
  <pre><code>version: '2'
  
  services:
      gateway-linkcs:
          image: node:7
          ports:
            - 3000:3000
          volumes:
            - ../Gateway:/usr/src/app
          working_dir: /usr/src/app
          command: yarn startdev
          networks:
            - back-linkcs
      postgres-user-linkcs:
          build:
              context: ../User
              dockerfile: docker/Dockerfile
          networks:
            - back-linkcs
      dev-user-linkcs:
          image: node:7
          ports:
            - 3001:3001
          volumes_from:
            - postgres-user-linkcs
          volumes:
            - ../User:/usr/src/app
          working_dir: /usr/src/app
          command: /usr/src/app/docker/scripts/start-node.sh
          environment:
            - NODE_ENV=development # change to 'production' for prod
            - GATEWAY_ADDRESS=gateway-linkcs:3000
          networks:
            - back-linkcs
  
  networks:
      back-linkcs:
  </code></pre>
  
  <p>My node application in dev-user is suppose to use gateway as a proxy to connect an api on the internet, and dev-user actually finds gateway, and is able to connect to it (using hostname 'gateway-linkcs')
  However, my gateway app cannot connect to the external API :</p>
  
  <pre><code>Error: getaddrinfo ENOTFOUND api.xxx api.xxx:80
       at errnoException (dns.js:28:10)
       at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)
  </code></pre>
  
  <p>I have tested starting the gateway outside of docker, (node index.js) and it works perfectly well.</p>
  
  <p>I think I am missing something with docker-compose networks, can someone help ?</p>
  
  <p>Thank you very much, Giltho.</p>