I have the same issue using docker-compose. I'd like to connect MongoDB with knowage, but get the same error message as described here (MongoSocketException / Unknown host exception).
Parameters Knowage UI
- Dialect: MongoDB
- Read Only: Yes
- Type: JDBC
- no username / password required
- URL: mongodb://172.18.1.4:27017/orion (container ip) or mongodb://localhost:27017/orion (localhost) or mongodb://mongodb:27017/orion (container name)
- Driver: mongo
Troubleshooting
I can exec container Knowage and ping MongoDB container by name and ip. Other way round I can also exec MongoDB container and ping Knowage container. But when I try to connect the data source using Knowage UI I get the issue above.
Ping from mongo
root@mongodb:/# ping fiware_knowage_1
PING fiware_knowage_1 (172.18.1.8) 56(84) bytes of data.
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=1 ttl=64 time=0.117 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=2 ttl=64 time=0.064 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=3 ttl=64 time=0.081 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=4 ttl=64 time=0.106 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=5 ttl=64 time=0.142 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=6 ttl=64 time=0.140 ms
^C
--- fiware_knowage_1 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5114ms
rtt min/avg/max/mdev = 0.064/0.108/0.142/0.028 ms
ping from knowage
root@mongodb:/# ping fiware_knowage_1
PING fiware_knowage_1 (172.18.1.8) 56(84) bytes of data.
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=1 ttl=64 time=0.117 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=2 ttl=64 time=0.064 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=3 ttl=64 time=0.081 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=4 ttl=64 time=0.106 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=5 ttl=64 time=0.142 ms
64 bytes from fiware_knowage_1.fiware_default (172.18.1.8): icmp_seq=6 ttl=64 time=0.140 ms
^C
--- fiware_knowage_1 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5114ms
rtt min/avg/max/mdev = 0.064/0.108/0.142/0.028 ms
Question
Why can't I connect to Mongo-DB even I am able to ping the other container using containername or ip address? I don't really understand com.mongodb.MongoSocketException / UnknownHostException here either