title: How to connect frontend to backend via docker-compose networks
body: <p>I'm trying to dockerize my angular + express application. I have a docker-compose file that creates the two containers, and I am able to hit the containers from my host machine(using my browser), but I'll just get a "ERR_NAME_NOT_RESOLVED" whenever I try to hit the backend from http requests made by my frontend. </p>
  
  <p>I've looked up the issue, and it seems like most suggest that the service name and container port should be enough to hit the the other container when they're on the same network. I've tried to hit "<a href="http://express:8000/user?user=030f0e70-9a8f-11e9-b5d1-f5cb6c0f3616" rel="noreferrer">http://express:8000/user?user=030f0e70-9a8f-11e9-b5d1-f5cb6c0f3616</a>" which I think should work given what I've seen from other places, but regardless, I get the same error.</p>
  
  <p>My docker-compose file looks like</p>
  
  <pre><code>version: '3' # specify docker-compose version
  
  # Define the services/containers to be run
  services:
    angular: # name of the first service
      build: ./ # specify the directory of the Dockerfile
      ports:
        - "4200:80" # specify port forewarding
      links:
        - "express"
      depends_on:
        - "express"
  
    express: #name of the second service
      build:  # specify the directory of the Dockerfile
        context: ./
        dockerfile: dockerfile.be
      ports:
        - "8000:8000" #specify ports forewarding
      expose:
        - "8000"
  </code></pre>
  
  <p>Ideally, I'd like my frontend to be able to hit the other container with a set endpoint, so I could deploy the application with minimal changes. I'd appreciate any advice. I feel like I'm missing something really simple, but after a few hours of tinkering, I still haven't caught it.</p>
  
  <p>Thanks!</p>