databasemongodbdockerconnectionstudio3t

Connect to mongoDB Server which runs in a Docker container


I am trying to connect to MongoDB server which is running in a Docker container on my windows 10 machine. However when I try to connect to localhost:27017 I get an error. I wonder what am I missing?

enter image description here

enter image description here

I tried to connect to localhost:27017


Solution

  • you need to expose the port of your docker container so something like docker run -p 27017:27017 ...

    https://docs.docker.com/engine/reference/commandline/run/