moleculer-node-realworld-example-app icon indicating copy to clipboard operation
moleculer-node-realworld-example-app copied to clipboard

Mongo connection error in docker

Open molobala opened this issue 7 years ago • 2 comments

I deployed the project in docker, But I get MongoError: getaddrinfo ENOTFOUND mongo mongo:27017 error Any Idea? Thank you!

molobala avatar Feb 28 '18 18:02 molobala

Did you deploy with docker compose up -d ? Could you show full log?

icebob avatar Feb 28 '18 19:02 icebob

Yes I used docker compose -d , I'm running under windows 7 (docker use virtual box so), that may cause the problem, because I'm not able to connect to mongo from cmd , even to access traefik , I had to use the virtual box address ip

Now to see log error I don't use -d flag anymore, Here are errors I got

articles_1   | [2018-02-28T20:04:35.347Z] INFO  34f17fac6be4-15/REGISTRY: Node 'eda477062b2e-15' connected.
articles_1   | [2018-02-28T20:04:42.474Z] ERROR 34f17fac6be4-15/ARTICLES: Connection error! { MongoError: failed to connect to server [mongo:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo mongo:27017]
articles_1   |     at Pool.<anonymous> (/app/node_modules/mongodb-core/lib/topologies/server.js:336:35)
articles_1   |     at emitOne (events.js:96:13)
articles_1   |     at Pool.emit (events.js:188:7)
articles_1   |     at Connection.<anonymous> (/app/node_modules/mongodb-core/lib/connection/pool.js:280:12)
articles_1   |     at Connection.g (events.js:292:16)
articles_1   |     at emitTwo (events.js:106:13)
articles_1   |     at Connection.emit (events.js:191:7)
articles_1   |     at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:187:49)
articles_1   |     at Socket.g (events.js:292:16)
articles_1   |     at emitOne (events.js:96:13)
articles_1   |     at Socket.emit (events.js:188:7)
articles_1   |     at connectErrorNT (net.js:1040:8)
articles_1   |     at _combinedTickCallback (internal/process/next_tick.js:80:11)
articles_1   |     at process._tickCallback (internal/process/next_tick.js:104:9)
articles_1   |   name: 'MongoError',
articles_1   |   message: 'failed to connect to server [mongo:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo mongo:27017]' }

molobala avatar Feb 28 '18 20:02 molobala