docker run --network container:myapp nginx

Category: Docker

docker run --network container:myapp nginx

Run a container sharing another's network

Puts the new container in the network namespace of myapp, so both share IP and ports and can talk over localhost. Useful for sidecar proxies and debug tools. The shared container must be running.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.