docker network connect --alias db mynet myapp

Category: Docker

docker network connect --alias db mynet myapp

Connect a container to a network with an alias

Attaches the running myapp container to mynet and registers the alias db on that network, so other containers resolve myapp as db. Useful for zero-downtime database swaps. A container can belong to multiple networks.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.