Linuxserver/unifi-controller: Can't connect to mongodb

Dear friends,

I would like to connect mongodb within container “linuxserver/unifi-controller”.

When I try:

mongo --port 21117 or mongo --port 21017

I get: mongo command not found.
And really there is no “mongo” in /usr/bin, only “mongod”

But when I try:
mongod

I get:
root@d1eec6ac7353:/usr/lib/unifi/bin# mongod
2019-08-28T14:49:44.971+0000 I CONTROL [initandlisten] MongoDB starting : pid=1176 port=27017 dbpath=/data/db 64-bit host=d1eec6ac7353
2019-08-28T14:49:44.971+0000 I CONTROL [initandlisten] db version v3.4.20
2019-08-28T14:49:44.972+0000 I CONTROL [initandlisten] git version: 447847d93d6e0a21b018d5df45528e815c7c13d8
2019-08-28T14:49:44.972+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2019-08-28T14:49:44.972+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-08-28T14:49:44.972+0000 I CONTROL [initandlisten] modules: none
2019-08-28T14:49:44.972+0000 I CONTROL [initandlisten] build environment:
2019-08-28T14:49:44.973+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2019-08-28T14:49:44.973+0000 I CONTROL [initandlisten] distarch: x86_64
2019-08-28T14:49:44.973+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-08-28T14:49:44.973+0000 I CONTROL [initandlisten] options: {}
2019-08-28T14:49:44.973+0000 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2019-08-28T14:49:44.974+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets…
2019-08-28T14:49:44.974+0000 I NETWORK [initandlisten] shutdown: going to flush diaglog…
2019-08-28T14:49:44.974+0000 I CONTROL [initandlisten] now exiting
2019-08-28T14:49:44.974+0000 I CONTROL [initandlisten] shutting down with code:100

Could you please help me to connect to mongodb within container “linuxserver/unifi-controller”.

I appreciate your help!!!

Best regards,
Juri

Answered on github: https://github.com/linuxserver/docker-unifi-controller/issues/22

I’ve installed mongodb-org-shell within the container:
$ apt install mongodb-org-shell

Connection:
$ mongo --host /usr/lib/unifi/run/mongodb-27117.sock

I found it in the following nice article:

This worked for me! Issue solved!

Thanks for your support, guys!