title: Connecting to Mongo Docker container from Mongo Compass on local machine?
body: <p>I have the following <code>docker compose</code> file that I use to spin up a <code>mongo</code> docker container which works as intended.</p>
  <p>However, I cannot seem to connect to the container from <code>compass</code> on my local machine.</p>
  <p>I executed <code>docker inspect</code> on my mongo container and got its <code>IP</code> and tried to connect using compass, but it didn't work - connection timed out.</p>
  <p>Is it the IP of my docker network or the IP of the mongo container I need?</p>
  <p><strong>docker compose file:</strong></p>
  <pre><code>version: &quot;3&quot;
  services:
    pokerStats:
      image: pokerStats
      container_name: pokerStats
      ports:
        - 8080:8080
      depends_on: 
        - db
    db:
      image: mongo
      container_name: mongo
      volumes:
        - ./database:/data
      ports:
        - &quot;27017:27017&quot;
  </code></pre>