title: docker-compose container port not showing up on localhost
body: <p>I am trying to run a docker-compose app that has two services. One to build a web server and the other to run the tests on it.</p>
  <p><code>docker-compose.yml</code></p>
  <pre><code>version: &quot;3.7&quot;
  services:
    web:
      build: .
      ports:
        - &quot;127.0.0.1:5000:5000&quot;
      expose:
        - 5000
    test:
      # expose:
      #   - 5000
      depends_on: 
        - web
      build: test_python/.
  </code></pre>
  <p><code>./Dockerfile</code></p>
  <pre><code>FROM python:buster
  RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
  
  # Add .cargo/bin to PATH
  ENV PATH=&quot;/root/.cargo/bin:${PATH}&quot;
  
  # Check cargo is visible
  RUN cargo --help
  WORKDIR /code
  COPY requirements.txt requirements.txt
  RUN pip3 install -r  requirements.txt
  EXPOSE 5000
  COPY test_python .
  CMD [ &quot;python3&quot;, &quot;base_routes.py&quot; ]
  </code></pre>
  <p><code>test_python/Dockerfile</code></p>
  <pre><code>FROM python:buster
  RUN pip3 install pytest requests
  COPY . .
  </code></pre>
  <p><code>base_routes.py</code></p>
  <pre><code>from robyn import Robyn, static_file, jsonify
  import asyncio
  
  app = Robyn(__file__)
  
  callCount = 0
  
  
  @app.get(&quot;/&quot;)
  async def h(request):
      print(request)
      global callCount
      callCount += 1
      message = &quot;Called &quot; + str(callCount) + &quot; times&quot;
      return message
  
  @app.get(&quot;/test&quot;)
  async def test(request):
      import os
      path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), &quot;test_python/index.html&quot;))
      return static_file(path)
  
  @app.get(&quot;/jsonify&quot;)
  async def json_get(request):
      return jsonify({&quot;hello&quot;: &quot;world&quot;})
  
  
  @app.post(&quot;/jsonify&quot;)
  async def json(request):
      print(request)
      return jsonify({&quot;hello&quot;: &quot;world&quot;})
  
  @app.post(&quot;/post&quot;)
  async def postreq(request):
      return bytearray(request[&quot;body&quot;]).decode(&quot;utf-8&quot;)
  
  @app.put(&quot;/put&quot;)
  async def putreq(request):
      return bytearray(request[&quot;body&quot;]).decode(&quot;utf-8&quot;)
  
  @app.delete(&quot;/delete&quot;)
  async def deletereq(request):
      return bytearray(request[&quot;body&quot;]).decode(&quot;utf-8&quot;)
  
  @app.patch(&quot;/patch&quot;)
  async def patchreq(request):
      return bytearray(request[&quot;body&quot;]).decode(&quot;utf-8&quot;)
  
  @app.get(&quot;/sleep&quot;)
  async def sleeper():
      await asyncio.sleep(5)
      return &quot;sleep function&quot;
  
  
  @app.get(&quot;/blocker&quot;)
  def blocker():
      import time
      time.sleep(10)
      return &quot;blocker function&quot;
  
  
  if __name__ == &quot;__main__&quot;:
      app.add_header(&quot;server&quot;, &quot;robyn&quot;)
      app.add_directory(route=&quot;/test_dir&quot;,directory_path=&quot;./test_dir/build&quot;, index_file=&quot;index.html&quot;)
      app.start(port=5000)
  
  </code></pre>
  <p>These are the files that I have used in my project. When I try to open <code>127.0.0.1:5000</code> from my machine, it shows nothing. However, when I log in the <code>web</code> container and do <code>curl http://localhost:5000/</code>, it gives the right response.</p>
  <p>I am unable to figure out how to access it on the host machine?</p>