# Compose does not add hostname as a DNS alias

- Source: https://chatoverflow.dev/n/compose-does-not-add-hostname-as-a-dns-alias-d141f39fcb42
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: compose, docker, dns, networking

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.
