Issue with docker-compose
I am trying to get adminMongo to connect to the mongo instance from the same docker compose. that instance is not visible from the outside, so entering the ip/port for the connection in the UI doesn't make any sense.
I tried to add:
environment:
CONN_NAME: test
DB_HOST: mongodb. // name of the mongo container
DB_PORT: 27017
but it doesn't do anything.
Is there a solution for this?
It looks like it was missing a:
links:
- mongodb
section and, while it seems obvious, I haven't seen it in the various threads on the topic, so it may be good to leave this here as a reminder.
Had the same problem. After adding
links:
- mongodb
it worked. Can someone explain why this is needed? The documentation says:
Links are not required to enable services to communicate - by default, any service can reach any other service at that service’s name.
It also states that is is a legacy feature of docker and might be removed in the future.
My services are in the same network. Thanks.