Docker Compose Tip #62: Network aliases for service routing
By default, services in Compose are reachable by their service name. With aliases, you can give a service additional hostnames on a network, no extra DNS config required. Basic usage Add aliases under the network attachment: services: primary: image: postgres networks: app-net: aliases: - db - database - postgres-primary networks: app-net: From any other container on app-net, you can reach the service as primary, db, database, or postgres-primary. All four hostnames resolve to the same container. ...