mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-05 13:11:30 +00:00
Networking API and UX documentation
More doc updates will follow Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<!--[metadata]>
|
||||
+++
|
||||
title = "network connect"
|
||||
description = "The network connect command description and usage"
|
||||
keywords = ["network, connect"]
|
||||
[menu.main]
|
||||
parent = "smn_cli"
|
||||
+++
|
||||
<![end-metadata]-->
|
||||
|
||||
# network connect
|
||||
|
||||
Usage: docker network connect [OPTIONS] NETWORK CONTAINER
|
||||
|
||||
Connects a container to a network
|
||||
|
||||
--help=false Print usage
|
||||
|
||||
Connects a running container to a network. This enables instant communication with other containers belonging to the same network.
|
||||
|
||||
```
|
||||
$ docker network create -d overlay multi-host-network
|
||||
$ docker run -d --name=container1 busybox top
|
||||
$ docker network connect multi-host-network container1
|
||||
```
|
||||
|
||||
the container will be connected to the network that is created and managed by the driver (multi-host overlay driver in the above example) or external network plugins.
|
||||
|
||||
Multiple containers can be connected to the same network and the containers in the same network will start to communicate with each other. If the driver/plugin supports multi-host connectivity, then the containers connected to the same multi-host network will be able to communicate seamlessly.
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<!--[metadata]>
|
||||
+++
|
||||
title = "network create"
|
||||
description = "The network create command description and usage"
|
||||
keywords = ["network, create"]
|
||||
[menu.main]
|
||||
parent = "smn_cli"
|
||||
+++
|
||||
<![end-metadata]-->
|
||||
|
||||
# network create
|
||||
|
||||
Usage: docker network create [OPTIONS] NETWORK-NAME
|
||||
|
||||
Creates a new network with a name specified by the user
|
||||
|
||||
-d, --driver= Driver to manage the Network
|
||||
--help=false Print usage
|
||||
|
||||
Creates a new network that containers can connect to. If the driver supports multi-host networking, the created network will be made available across all the hosts in the cluster. Daemon will do its best to identify network name conflicts. But its the users responsibility to make sure network name is unique across the cluster. You create a network and then configure the container to use it, for example:
|
||||
|
||||
```
|
||||
$ docker network create -d overlay multi-host-network
|
||||
$ docker run -itd --net=multi-host-network busybox
|
||||
```
|
||||
|
||||
the container will be connected to the network that is created and managed by the driver (multi-host overlay driver in the above example) or external network plugins.
|
||||
|
||||
Multiple containers can be connected to the same network and the containers in the same network will start to communicate with each other. If the driver/plugin supports multi-host connectivity, then the containers connected to the same multi-host network will be able to communicate seamlessly.
|
||||
|
||||
*Note*: UX needs enhancement to accept network options to be passed to the drivers
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<!--[metadata]>
|
||||
+++
|
||||
title = "network disconnect"
|
||||
description = "The network disconnect command description and usage"
|
||||
keywords = ["network, disconnect"]
|
||||
[menu.main]
|
||||
parent = "smn_cli"
|
||||
+++
|
||||
<![end-metadata]-->
|
||||
|
||||
# network disconnect
|
||||
|
||||
Usage: docker network disconnect [OPTIONS] NETWORK CONTAINER
|
||||
|
||||
Disconnects a container from a network
|
||||
|
||||
--help=false Print usage
|
||||
|
||||
Disconnects a running container from a network.
|
||||
|
||||
```
|
||||
$ docker network create -d overlay multi-host-network
|
||||
$ docker run -d --net=multi-host-network --name=container1 busybox top
|
||||
$ docker network disconnect multi-host-network container1
|
||||
```
|
||||
|
||||
the container will be disconnected from the network.
|
||||
@@ -0,0 +1,49 @@
|
||||
<!--[metadata]>
|
||||
+++
|
||||
title = "network inspect"
|
||||
description = "The network inspect command description and usage"
|
||||
keywords = ["network, inspect"]
|
||||
[menu.main]
|
||||
parent = "smn_cli"
|
||||
+++
|
||||
<![end-metadata]-->
|
||||
|
||||
# network inspect
|
||||
|
||||
Usage: docker network inspect [OPTIONS] NETWORK
|
||||
|
||||
Displays detailed information on a network
|
||||
|
||||
--help=false Print usage
|
||||
|
||||
Returns information about a network. By default, this command renders all results
|
||||
in a JSON object.
|
||||
|
||||
Example output:
|
||||
|
||||
```
|
||||
$ sudo docker run -itd --name=container1 busybox
|
||||
f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27
|
||||
|
||||
$ sudo docker run -itd --name=container2 busybox
|
||||
bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727
|
||||
|
||||
$ sudo docker network inspect bridge
|
||||
{
|
||||
"name": "bridge",
|
||||
"id": "7fca4eb8c647e57e9d46c32714271e0c3f8bf8d17d346629e2820547b2d90039",
|
||||
"driver": "bridge",
|
||||
"containers": {
|
||||
"bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727": {
|
||||
"endpoint": "e0ac95934f803d7e36384a2029b8d1eeb56cb88727aa2e8b7edfeebaa6dfd758",
|
||||
"mac_address": "02:42:ac:11:00:03",
|
||||
"ipv4_address": "172.17.0.3/16"
|
||||
},
|
||||
"f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27": {
|
||||
"endpoint": "31de280881d2a774345bbfb1594159ade4ae4024ebfb1320cb74a30225f6a8ae",
|
||||
"mac_address": "02:42:ac:11:00:02",
|
||||
"ipv4_address": "172.17.0.2/16"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
<!--[metadata]>
|
||||
+++
|
||||
title = "network ls"
|
||||
description = "The network ls command description and usage"
|
||||
keywords = ["network, list"]
|
||||
[menu.main]
|
||||
parent = "smn_cli"
|
||||
+++
|
||||
<![end-metadata]-->
|
||||
|
||||
# docker network ls
|
||||
|
||||
Usage: docker network ls [OPTIONS]
|
||||
|
||||
Lists all the networks created by the user
|
||||
--help=false Print usage
|
||||
-l, --latest=false Show the latest network created
|
||||
-n=-1 Show n last created networks
|
||||
--no-trunc=false Do not truncate the output
|
||||
-q, --quiet=false Only display numeric IDs
|
||||
|
||||
Lists all the networks Docker knows about. This include the networks that spans across multiple hosts in a cluster.
|
||||
|
||||
Example output:
|
||||
|
||||
```
|
||||
$ sudo docker network ls
|
||||
NETWORK ID NAME DRIVER
|
||||
7fca4eb8c647 bridge bridge
|
||||
9f904ee27bf5 none null
|
||||
cf03ee007fb4 host host
|
||||
```
|
||||
@@ -0,0 +1,23 @@
|
||||
<!--[metadata]>
|
||||
+++
|
||||
title = "network rm"
|
||||
description = "the network rm command description and usage"
|
||||
keywords = ["network, rm"]
|
||||
[menu.main]
|
||||
parent = "smn_cli"
|
||||
+++
|
||||
<![end-metadata]-->
|
||||
|
||||
# network rm
|
||||
|
||||
Usage: docker network rm [OPTIONS] NETWORK
|
||||
|
||||
Deletes a network
|
||||
|
||||
--help=false Print usage
|
||||
|
||||
Removes a network. You cannot remove a network that is in use by 1 or more containers.
|
||||
|
||||
```
|
||||
$ docker network rm my-network
|
||||
```
|
||||
Reference in New Issue
Block a user