title: docker compose communication with container
body: <p>I am trying to create an example to create two WEB API 's and containerize them and to communicate between them.
  I would like to see the side car design pattern, I have found an example in Github that I am trying to run.</p>
  <p><a href="https://github.com/cesaroll/dotnet-sidecar" rel="nofollow noreferrer">https://github.com/cesaroll/dotnet-sidecar</a></p>
  <p>In the above example, HelloAPI makes a call to HelloSideCar API which is a different project.
  In the HelloAPI a call is made to another API in another project. I am trying to run in local using Docker Compose.</p>
  <p>When I try to hit the API from HelloAPI(localhost:8080/FromSidecar) project to SideCarAPI, <strong>I see a 404 error, request is not going to another container
  Below Is my Docker Compose</strong></p>
  <pre><code># docker-compose up -d
  # docker-compose stop
  # docker-compose rm -f
  
  version: '3.8'
  services:
    hello-sidecar-api:
      image: hello-sidecar-api:latest
      container_name: hello-sidecar-api
      ports:
        - &quot;8180:8080&quot;
  
    hello-api:
      image: helloapi:latest
      container_name: hello-api
      environment:
        - SIDERCAR_URL=http://localhost:8180/
      depends_on:
        - hello-sidecar-api
      ports:
        - &quot;8080:8080&quot;
  </code></pre>