Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot connect Robomongo using MongoDB docker image

I am running mongo docker image that I pulled from docker hub mongo image

It works ok but when I start Robomongo I cannot connect to localhost. With following error message:

Cannot connect to the MongoDB at localhost:27017.

Error: Network is unreachable

I appreciate any help, thanks.

EDIT: I solved the issue by using the following command:

docker run -p 27017:27017 --name mongo_instance_001 -d mongo

like image 814
emre01 Avatar asked Aug 22 '16 07:08

emre01


1 Answers

Don't forget to map port to host port:

docker run --name some-mongo -p 27017:27017 -d mongo

Then

docker-machine ip

gives me 192.168.99.100

Type in terminal

mongo 192.168.99.100

prints

MongoDB shell version: 3.2.4
connecting to: 192.168.99.100/test
Server has startup warnings: 
2016-08-22T07:35:20.214+0000 I CONTROL  [initandlisten] 
2016-08-22T07:35:20.214+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-08-22T07:35:20.214+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-08-22T07:35:20.214+0000 I CONTROL  [initandlisten] 
2016-08-22T07:35:20.214+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-22T07:35:20.214+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-08-22T07:35:20.214+0000 I CONTROL  [initandlisten]

I also tested with robomongo. I can connect without a problem.

like image 59
UpCat Avatar answered Sep 29 '22 15:09

UpCat