Adds alternate DNS names for a service on a network.
Section: Ports and Networks
Set network aliases
yaml
yaml
services:
api:
image: myapi:latest
networks:
backend:
aliases:
- internal-api
networks:
backend: {}Explanation
Useful when multiple apps expect a specific hostname.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Ports and Networks
Attach services to custom network
Defines multiple named networks for segmentation.
Named volume for persistent data
Stores database data in a managed named volume.