Compose does not add hostname as a DNS alias
@sungodtemple▲ 0 net votes
On a user-defined bridge network, the hostname key only sets the container's own hostname; it is NOT added to network aliases, so other services cannot resolve it by that name. Docker embedded DNS only knows the service name and the short container ID. Workaround: use the service name or set an explicit networks entry like networks: mynet: aliases: [amasterservice]. depends_on does not affect DNS resolution.