github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/docs/reference/commandline/network_inspect.md (about) 1 --- 2 title: "network inspect" 3 description: "The network inspect command description and usage" 4 keywords: "network, inspect, user-defined" 5 --- 6 7 <!-- This file is maintained within the docker/docker Github 8 repository at https://github.com/docker/docker/. Make all 9 pull requests against that repo. If you see this file in 10 another repository, consider it read-only there, as it will 11 periodically be overwritten by the definitive file. Pull 12 requests which include edits to this file in other repositories 13 will be rejected. 14 --> 15 16 # network inspect 17 18 ```markdown 19 Usage: docker network inspect [OPTIONS] NETWORK [NETWORK...] 20 21 Display detailed information on one or more networks 22 23 Options: 24 -f, --format string Format the output using the given Go template 25 --help Print usage 26 ``` 27 28 Returns information about one or more networks. By default, this command renders all results in a JSON object. For example, if you connect two containers to the default `bridge` network: 29 30 ```bash 31 $ sudo docker run -itd --name=container1 busybox 32 f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27 33 34 $ sudo docker run -itd --name=container2 busybox 35 bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727 36 ``` 37 38 The `network inspect` command shows the containers, by id, in its 39 results. For networks backed by multi-host network driver, such as Overlay, 40 this command also shows the container endpoints in other hosts in the 41 cluster. These endpoints are represented as "ep-{endpoint-id}" in the output. 42 However, for swarm-scoped networks, only the endpoints that are local to the 43 node are shown. 44 45 You can specify an alternate format to execute a given 46 template for each result. Go's 47 [text/template](http://golang.org/pkg/text/template/) package describes all the 48 details of the format. 49 50 ```bash 51 $ sudo docker network inspect bridge 52 [ 53 { 54 "Name": "bridge", 55 "Id": "b2b1a2cba717161d984383fd68218cf70bbbd17d328496885f7c921333228b0f", 56 "Created": "2016-10-19T04:33:30.360899459Z", 57 "Scope": "local", 58 "Driver": "bridge", 59 "IPAM": { 60 "Driver": "default", 61 "Config": [ 62 { 63 "Subnet": "172.17.42.1/16", 64 "Gateway": "172.17.42.1" 65 } 66 ] 67 }, 68 "Internal": false, 69 "Containers": { 70 "bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727": { 71 "Name": "container2", 72 "EndpointID": "0aebb8fcd2b282abe1365979536f21ee4ceaf3ed56177c628eae9f706e00e019", 73 "MacAddress": "02:42:ac:11:00:02", 74 "IPv4Address": "172.17.0.2/16", 75 "IPv6Address": "" 76 }, 77 "f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27": { 78 "Name": "container1", 79 "EndpointID": "a00676d9c91a96bbe5bcfb34f705387a33d7cc365bac1a29e4e9728df92d10ad", 80 "MacAddress": "02:42:ac:11:00:01", 81 "IPv4Address": "172.17.0.1/16", 82 "IPv6Address": "" 83 } 84 }, 85 "Options": { 86 "com.docker.network.bridge.default_bridge": "true", 87 "com.docker.network.bridge.enable_icc": "true", 88 "com.docker.network.bridge.enable_ip_masquerade": "true", 89 "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", 90 "com.docker.network.bridge.name": "docker0", 91 "com.docker.network.driver.mtu": "1500" 92 }, 93 "Labels": {} 94 } 95 ] 96 ``` 97 98 Returns the information about the user-defined network: 99 100 ```bash 101 $ docker network create simple-network 102 69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a 103 $ docker network inspect simple-network 104 [ 105 { 106 "Name": "simple-network", 107 "Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a", 108 "Created": "2016-10-19T04:33:30.360899459Z", 109 "Scope": "local", 110 "Driver": "bridge", 111 "IPAM": { 112 "Driver": "default", 113 "Config": [ 114 { 115 "Subnet": "172.22.0.0/16", 116 "Gateway": "172.22.0.1" 117 } 118 ] 119 }, 120 "Containers": {}, 121 "Options": {}, 122 "Labels": {} 123 } 124 ] 125 ``` 126 127 For swarm mode overlay networks `network inspect` also shows the IP address and node name 128 of the peers. Peers are the nodes in the swarm cluster which have at least one task attached 129 to the network. Node name is of the format `<hostname>-<unique ID>`. 130 131 ```bash 132 $ docker network inspect ingress 133 [ 134 { 135 "Name": "ingress", 136 "Id": "j0izitrut30h975vk4m1u5kk3", 137 "Created": "2016-11-08T06:49:59.803387552Z", 138 "Scope": "swarm", 139 "Driver": "overlay", 140 "EnableIPv6": false, 141 "IPAM": { 142 "Driver": "default", 143 "Options": null, 144 "Config": [ 145 { 146 "Subnet": "10.255.0.0/16", 147 "Gateway": "10.255.0.1" 148 } 149 ] 150 }, 151 "Internal": false, 152 "Attachable": false, 153 "Containers": { 154 "ingress-sbox": { 155 "Name": "ingress-endpoint", 156 "EndpointID": "40e002d27b7e5d75f60bc72199d8cae3344e1896abec5eddae9743755fe09115", 157 "MacAddress": "02:42:0a:ff:00:03", 158 "IPv4Address": "10.255.0.3/16", 159 "IPv6Address": "" 160 } 161 }, 162 "Options": { 163 "com.docker.network.driver.overlay.vxlanid_list": "256" 164 }, 165 "Labels": {}, 166 "Peers": [ 167 { 168 "Name": "net-1-1d22adfe4d5c", 169 "IP": "192.168.33.11" 170 }, 171 { 172 "Name": "net-2-d55d838b34af", 173 "IP": "192.168.33.12" 174 }, 175 { 176 "Name": "net-3-8473f8140bd9", 177 "IP": "192.168.33.13" 178 } 179 ] 180 } 181 ] 182 ``` 183 184 ## Related information 185 186 * [network disconnect ](network_disconnect.md) 187 * [network connect](network_connect.md) 188 * [network create](network_create.md) 189 * [network ls](network_ls.md) 190 * [network rm](network_rm.md) 191 * [network prune](network_prune.md) 192 * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/)