docker network connect
network connect
Usage: docker network connect [OPTIONS] NETWORK CONTAINER Connects a container to a network --alias=[] Add network-scoped alias for the container --help Print usage --ip IPv4 Address --ip6 IPv6 Address --link=[] Add a link to another container
Connects a container to a network. You can connect a container by name or by ID. Once connected, the container can communicate with other containers in the same network.
$ docker network connect multi-host-network container1
You can also use the docker run --net=<network-name>
option to start a container and immediately connect it to a network.
$ docker run -itd --net=multi-host-network busybox
You can specify the IP address you want to be assigned to the container’s interface.
$ docker network connect --ip 10.10.36.122 multi-host-network container2 登录查看完整内容