title: docker-compose resolve hostname in url
body: <p>Tried looking around but couldn't find anything close to what I need.</p>
  
  <p>I have a docker-compose file with a docker container (<code>web</code>) that uses another container's IP (<code>api</code>) in its environment variable by resolving the hostname:</p>
  
  <pre><code>version: '3'
  services:
    web:
      build: ../client/
      ports:
        - "5000:5000"
        - "3000:3000"
      environment:
        REACT_APP_API_DEV: http://api:8000/server/graphql
    api:
      build: ../server/
      env_file:
        - server_variables.env
      ports:
        - "8000:8000"
    redis:
      image: "redis:alpine"
  </code></pre>
  
  <p>My issue is that <code>web</code> doesn't resolve this variable when it's running. I can ping <code>api</code> just fine inside the <code>web</code> container but <code>http://api:8000</code> doesn't resolve properly. I also tried making HOST=api the variable and building the URI manually but that doesn't work either.</p>
  
  <p>EDIT: I added a complete docker-compose.yml file for reference. I can <code>curl</code> the <code>api</code> just fine from inside the <code>web</code> container, but my app can't seem to resolve it properly. I'm using NodeJS and React</p>