mirror of
https://github.com/docker/cli.git
synced 2025-08-01 04:26:55 +03:00
Add missing documentation for static IP options
Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
committed by
Tibor Vass
parent
1e83a27ca1
commit
d3aa590eec
@ -46,6 +46,8 @@ Creates a new container.
|
||||
-h, --hostname="" Container host name
|
||||
--help Print usage
|
||||
-i, --interactive Keep STDIN open even if not attached
|
||||
--ip="" Container IPv4 address (e.g. 172.30.100.104)
|
||||
--ip6="" Container IPv6 address (e.g. 2001:db8::33)
|
||||
--ipc="" IPC namespace to use
|
||||
--isolation="" Container isolation technology
|
||||
--kernel-memory="" Kernel memory limit
|
||||
|
@ -15,7 +15,7 @@ parent = "smn_cli"
|
||||
Connects a container to a network
|
||||
|
||||
--help Print usage
|
||||
--ip IP Address
|
||||
--ip IPv4 Address
|
||||
--ip6 IPv6 Address
|
||||
--link=[] Add a link to another container
|
||||
|
||||
@ -46,11 +46,22 @@ $ docker network connect --link container1:c1 multi-host-network container2
|
||||
```
|
||||
|
||||
You can pause, restart, and stop containers that are connected to a network.
|
||||
Paused containers remain connected and a revealed by a `network inspect`. When
|
||||
the container is stopped, it does not appear on the network until you restart
|
||||
it. The container's IP address is not guaranteed to remain the same when a
|
||||
stopped container rejoins the network, unless you specified one when you run
|
||||
`docker network connect` command.
|
||||
Paused containers remain connected and can be revealed by a `network inspect`.
|
||||
When the container is stopped, it does not appear on the network until you restart
|
||||
it. If specified, the container's IP address(es) will be reapplied (if still available)
|
||||
when a stopped container rejoins the network. One way to guarantee that the container
|
||||
will be assigned the same IP addresses when it rejoins the network after a stop
|
||||
or a disconnect, is to specify the `--ip-range` when creating the network, and choose
|
||||
the static IP address(es) from outside the range. This will ensure that the IP address
|
||||
will not be given to other dynamic containers while this container is not on the network.
|
||||
|
||||
```bash
|
||||
$ docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 multi-host-network
|
||||
```
|
||||
|
||||
```bash
|
||||
$ docker network connect --ip 172.20.128.2 multi-host-network container2
|
||||
```
|
||||
|
||||
To verify the container is connected, use the `docker network inspect` command. Use `docker network disconnect` to remove a container from the network.
|
||||
|
||||
|
@ -46,6 +46,8 @@ parent = "smn_cli"
|
||||
-h, --hostname="" Container host name
|
||||
--help Print usage
|
||||
-i, --interactive Keep STDIN open even if not attached
|
||||
--ip="" Container IPv4 address (e.g. 172.30.100.104)
|
||||
--ip6="" Container IPv6 address (e.g. 2001:db8::33)
|
||||
--ipc="" IPC namespace to use
|
||||
--isolation="" Container isolation technology
|
||||
--kernel-memory="" Kernel memory limit
|
||||
@ -56,8 +58,6 @@ parent = "smn_cli"
|
||||
--log-opt=[] Log driver specific options
|
||||
-m, --memory="" Memory limit
|
||||
--mac-address="" Container MAC address (e.g. 92:d0:c6:0a:29:33)
|
||||
--ip="" Container IPv4 address (e.g. 172.30.100.104)
|
||||
--ip6="" Container IPv6 address (e.g. 2001:db8::33)
|
||||
--memory-reservation="" Memory soft limit
|
||||
--memory-swap="" A positive integer equal to memory plus swap. Specify -1 to enable unlimited swap.
|
||||
--memory-swappiness="" Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
|
||||
@ -330,6 +330,13 @@ This adds the `busybox` container to the `mynet` network.
|
||||
$ docker run -itd --net=my-multihost-network busybox
|
||||
```
|
||||
|
||||
You can also choose the IP addresses for the container with `--ip` and `--ip6`
|
||||
flags when you start the container on a user-defined network.
|
||||
|
||||
```bash
|
||||
$ docker run -itd --net=my-multihost-network --ip=10.10.9.75 busybox
|
||||
```
|
||||
|
||||
If you want to add a running container to a network use the `docker network connect` subcommand.
|
||||
|
||||
You can connect multiple containers to the same network. Once connected, the
|
||||
|
Reference in New Issue
Block a user