Docker Community Forums

Share and learn in the Docker community.

Can't connect to mongodb


(Decemb3r) #1

Expected behavior

CRUD operation on DB like i can do on Docker Toolbox

Actual behavior

info: Mongoose disconnected
error: Mongoose connection error: MongoError: getaddrinfo ENOTFOUND docker.local docker.local:27017

Docker-compose snippet:

go:
build: …/go
image: test/business
container_name: hr-go
volumes:
- …/go/app:/var/www
ports:
- "4002:4002"
environment:
- GO_PORT=4002
- GO_ADDR=docker.local
- DB_PORT=27017
- DB_ADDR=docker.local
command: gulp nodemon
db:
image: mongo:3.2
ports:
- “27017:27017”

Information

Windows 10, latest Docker for Windows


(Michael Friis) #2

Where are you trying to connect from? If it’s from the host, then you should use localhost:27017


(Nitikishu) #3

Can I connect localhost db into docker machine another running container (application). If so can you share the steps pls.