everywhere is localhost
the docker host localhost is the docker host
the mongo container locahost is 172.17.0.3 (on my machine)
the app container localhost is 172.17.0.4 (on my machine)…
NEVER use ‘localhost’… cause you will have SO many issues trying to figure out what you mean from where…
mongo is working from the container at 172.17.0.3 on my machine. and as I pointed out before from the docker HOST there are two ways to get to the container…
from ANOTHER container, you do NOT come back to the docker host to go to the mongo container, you go direct
I started another container (ubuntu), installed the mongo client and
root@d7c5ad369d2a:/# mongo 172.17.0.3:27017
MongoDB shell version: 3.2.19
connecting to: 172.17.0.3:27017/test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
2018-03-03T17:12:42.203+0000 I STORAGE [initandlisten]
2018-03-03T17:12:42.203+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-03-03T17:12:42.203+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-03-03T17:12:44.093+0000 I CONTROL [initandlisten]
2018-03-03T17:12:44.093+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-03-03T17:12:44.093+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-03-03T17:12:44.093+0000 I CONTROL [initandlisten]
2018-03-03T17:12:44.093+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-03-03T17:12:44.093+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2018-03-03T17:12:44.093+0000 I CONTROL [initandlisten]
> show dbs;
admin 0.000GB
config 0.000GB
local 0.000GB
>
worked just as expected