I have two different services on one server up and running with docker.
One service contains metabase with following docker-compose file.
metabase:
container_name: metabase
image: metabase/metabase:latest
ports:
- "3102:3000"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- metabase-data:/metabase
And another service contains mongo db:
mongodb:
image: mongo:4.4
restart: always
ports:
- ${MONGODB_PORT:-27017}:27017
volumes:
- mongodb-data:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGODB_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_PASSWORD}
I tried host.docker.internal
, my server public address, localhost etc but nothing works. and always receive connection timeout.
Netcat test is sucessfull from my local machine
nc -v 212.xx.xxx.175 27017
Connection to 212.xx.xxx.175 27017 port [tcp/*] succeeded!
But tried these in metabase container and all of them ends up with 'operation timed out'
nc -v host.docker.internal 27017
nc: host.docker.internal (172.17.0.1:0): Operation timed out
I also can access my database from mongo compass app, (so im pretty sure it's not about firewall) but no chance when using metabase.