From one container we are not able to resolve another one based on service names.
We could use port nat in the docker-compose and resolve on “localhost” but different ports for different containers. But Do we have other options?
So far we have tried adding “hostname:” with the same name as service name to the service, and have also tried to have all services in ‘bridge’ or ‘host’ without this making any difference.
If it is not clear what we try to do, from service-b we would like to run command “curl service-a/index.html”
version: '2.1' services: service-a: build: ./service-a network_mode: "host" hostname: service-a network_mode: "host" ports: - "80:80" service-b: build: ./service-b hostname: service-b network_mode: "bridge" service-c: build: ./service-c network_mode: "bridge" hostname: service-c expose: - "8080"