I have the following configuration in my
version: '3.3' services: service-1: container_name: 'service-1' build: './service-1' depends_on: - 'mongo' - 'consul' networks: backend: aliases: - service-1 service-2: build: './service-2' ports: - '8825:8825' - '8835:8835' networks: frontend: backend: aliases: - service-2 depends_on: - 'mongo' - 'consul' consul: image: 'consul:latest' networks: backend: aliases: - consul mongo: image: 'mongo:latest' networks: backend: aliases: - mongo networks: frontend: backend: internal: true
When my containers start they are not able to communicate between each other using host names. Most of containers use the mongo db container, but they are not able even reach it and I am getting the following error.
Error connecting to mongo : no reachable servers
Please help me to solve the problem, I got stuck.