Answers for "mongodb connect to docker"

0

docker connect to local mongo

ENV MONGO_HOST "host.docker.internal"

//https://tsmx.net/docker-local-mongodb/

You can use: 172.17.0.1 as it is the default host ip that the containers can see. But you need to configure Mongo to listen to 0.0.0.0.

From docker 18.03 onwards the recommendation is to connect to the special DNS name host.docker.internal

For previous versions you can use DNS names docker.for.mac.localhost or docker.for.windows.localhost.
Posted by: Guest on March-23-2022
0

access mongodb running in docker

docker exec -it mongodb bash
mongo
Posted by: Guest on May-31-2020
0

mongodb as docker container

docker run --name mongodb -d mongo
Posted by: Guest on March-29-2022

Browse Popular Code Answers by Language