title: Docker - send http request from one container to another
body: <p>I cannot send an HTTP request to backend container when I'm running app on AWS server production. However, when I'm running app locally I can make requests to backend just fine. For making requests I use fetch:</p>
  
  <pre><code>fetch('http://localhost:8000/something')
  </code></pre>
  
  <p>Here is how project structure looks like:</p>
  
  <pre><code>.
  ├── docker-compose.yml
  |
  ├── backend
  │   ├── Dockerfile
  │   └── server.js
  |
  └── frontend
      ├── Dockerfile
      ├── package.json
      ├── public
      │   └── index.html
      └── src
         ├── components
         ├── data
         ├── index.js
         ├── routes.js
         ├── static
         ├── tests
         └── views
  </code></pre>
  
  <p>docker-compose.yml:</p>
  
  <pre><code>version: '3'
  
  services:
    frontend:
      build:
        context: .
        dockerfile: frontend/Dockerfile
      volumes:
        - ./frontend:/frontend
      ports:
        - "80:5000"
      links:
        - backend
    backend:
      build:
        context: .
        dockerfile: backend/Dockerfile
      volumes:
        - ./backend:/backend
      ports:
        - "8000:8000"
  </code></pre>
  
  <p>Dockerfile in frontend:</p>
  
  <pre><code>FROM node:latest
  
  RUN mkdir -p /frontend
  
  WORKDIR /frontend
  
  ADD . /frontend
  
  VOLUME ["/frontend"]
  
  EXPOSE 5000
  
  CMD yarn &amp;&amp; yarn build &amp;&amp; yarn global add serve &amp;&amp; serve -s build
  </code></pre>
  
  <p>Dockerfile in backend:</p>
  
  <pre><code>FROM node:latest
  
  RUN mkdir -p /backend
  
  WORKDIR /backend
  
  ADD . /backend
  
  VOLUME ["/backend"]
  
  EXPOSE 8000
  
  CMD yarn &amp;&amp; yarn start
  </code></pre>
  
  <p>Can someone explain me what is wrong with my config? I'm very confused, because it works without any issues locally.</p>