Merge pull request #19566 from dvdksn/multiple-nets

network: multiple nets with --network
This commit is contained in:
David Karlsson 2024-03-06 05:47:43 +01:00 committed by GitHub
commit fb3182bae2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -139,8 +139,9 @@ A container receives an IP address out of the IP subnet of the network.
The Docker daemon performs dynamic subnetting and IP address allocation for containers. The Docker daemon performs dynamic subnetting and IP address allocation for containers.
Each network also has a default subnet mask and gateway. Each network also has a default subnet mask and gateway.
When a container starts, it can only attach to a single network, using the `--network` flag. You can connect a running container to multiple networks,
You can connect a running container to additional networks using the `docker network connect` command. either by passing the `--network` flag multiple times when creating the container,
or using the `docker network connect` command for already running containers.
In both cases, you can use the `--ip` or `--ip6` flags to specify the container's IP address on that particular network. In both cases, you can use the `--ip` or `--ip6` flags to specify the container's IP address on that particular network.
In the same way, a container's hostname defaults to be the container's ID in Docker. In the same way, a container's hostname defaults to be the container's ID in Docker.