github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/man/src/network/inspect.md (about) 1 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: 2 3 ```bash 4 $ sudo docker run -itd --name=container1 busybox 5 f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27 6 7 $ sudo docker run -itd --name=container2 busybox 8 bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727 9 ``` 10 11 The `network inspect` command shows the containers, by id, in its 12 results. You can specify an alternate format to execute a given 13 template for each result. Go's 14 [text/template](http://golang.org/pkg/text/template/) package 15 describes all the details of the format. 16 17 ```bash 18 $ sudo docker network inspect bridge 19 [ 20 { 21 "Name": "bridge", 22 "Id": "b2b1a2cba717161d984383fd68218cf70bbbd17d328496885f7c921333228b0f", 23 "Scope": "local", 24 "Driver": "bridge", 25 "IPAM": { 26 "Driver": "default", 27 "Config": [ 28 { 29 "Subnet": "172.17.42.1/16", 30 "Gateway": "172.17.42.1" 31 } 32 ] 33 }, 34 "Internal": false, 35 "Ingress": false, 36 "Containers": { 37 "bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727": { 38 "Name": "container2", 39 "EndpointID": "0aebb8fcd2b282abe1365979536f21ee4ceaf3ed56177c628eae9f706e00e019", 40 "MacAddress": "02:42:ac:11:00:02", 41 "IPv4Address": "172.17.0.2/16", 42 "IPv6Address": "" 43 }, 44 "f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27": { 45 "Name": "container1", 46 "EndpointID": "a00676d9c91a96bbe5bcfb34f705387a33d7cc365bac1a29e4e9728df92d10ad", 47 "MacAddress": "02:42:ac:11:00:01", 48 "IPv4Address": "172.17.0.1/16", 49 "IPv6Address": "" 50 } 51 }, 52 "Options": { 53 "com.docker.network.bridge.default_bridge": "true", 54 "com.docker.network.bridge.enable_icc": "true", 55 "com.docker.network.bridge.enable_ip_masquerade": "true", 56 "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0", 57 "com.docker.network.bridge.name": "docker0", 58 "com.docker.network.driver.mtu": "1500" 59 } 60 } 61 ] 62 ``` 63 64 Returns the information about the user-defined network: 65 66 ```bash 67 $ docker network create simple-network 68 69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a 69 $ docker network inspect simple-network 70 [ 71 { 72 "Name": "simple-network", 73 "Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a", 74 "Scope": "local", 75 "Driver": "bridge", 76 "IPAM": { 77 "Driver": "default", 78 "Config": [ 79 { 80 "Subnet": "172.22.0.0/16", 81 "Gateway": "172.22.0.1" 82 } 83 ] 84 }, 85 "Containers": {}, 86 "Options": {} 87 } 88 ] 89 ``` 90 91 `docker network inspect --verbose` for swarm mode overlay networks shows service-specific 92 details such as the service's VIP and port mappings. It also shows IPs of service tasks, 93 and the IPs of the nodes where the tasks are running. 94 95 Following is an example output for an overlay network `ov1` that has one service `s1` 96 attached to. service `s1` in this case has three replicas. 97 98 ```bash 99 $ docker network inspect --verbose ov1 100 [ 101 { 102 "Name": "ov1", 103 "Id": "ybmyjvao9vtzy3oorxbssj13b", 104 "Created": "2017-03-13T17:04:39.776106792Z", 105 "Scope": "swarm", 106 "Driver": "overlay", 107 "EnableIPv6": false, 108 "IPAM": { 109 "Driver": "default", 110 "Options": null, 111 "Config": [ 112 { 113 "Subnet": "10.0.0.0/24", 114 "Gateway": "10.0.0.1" 115 } 116 ] 117 }, 118 "Internal": false, 119 "Attachable": false, 120 "Ingress": false, 121 "Containers": { 122 "020403bd88a15f60747fd25d1ad5fa1272eb740e8a97fc547d8ad07b2f721c5e": { 123 "Name": "s1.1.pjn2ik0sfgkfzed3h0s00gs9o", 124 "EndpointID": "ad16946f416562d658f3bb30b9830d73ad91ccf6feae44411269cd0ff674714e", 125 "MacAddress": "02:42:0a:00:00:04", 126 "IPv4Address": "10.0.0.4/24", 127 "IPv6Address": "" 128 } 129 }, 130 "Options": { 131 "com.docker.network.driver.overlay.vxlanid_list": "4097" 132 }, 133 "Labels": {}, 134 "Peers": [ 135 { 136 "Name": "net-3-5d3cfd30a58c", 137 "IP": "192.168.33.13" 138 }, 139 { 140 "Name": "net-1-6ecbc0040a73", 141 "IP": "192.168.33.11" 142 }, 143 { 144 "Name": "net-2-fb80208efd75", 145 "IP": "192.168.33.12" 146 } 147 ], 148 "Services": { 149 "s1": { 150 "VIP": "10.0.0.2", 151 "Ports": [], 152 "LocalLBIndex": 257, 153 "Tasks": [ 154 { 155 "Name": "s1.2.q4hcq2aiiml25ubtrtg4q1txt", 156 "EndpointID": "040879b027e55fb658e8b60ae3b87c6cdac7d291e86a190a3b5ac6567b26511a", 157 "EndpointIP": "10.0.0.5", 158 "Info": { 159 "Host IP": "192.168.33.11" 160 } 161 }, 162 { 163 "Name": "s1.3.yawl4cgkp7imkfx469kn9j6lm", 164 "EndpointID": "106edff9f120efe44068b834e1cddb5b39dd4a3af70211378b2f7a9e562bbad8", 165 "EndpointIP": "10.0.0.3", 166 "Info": { 167 "Host IP": "192.168.33.12" 168 } 169 }, 170 { 171 "Name": "s1.1.pjn2ik0sfgkfzed3h0s00gs9o", 172 "EndpointID": "ad16946f416562d658f3bb30b9830d73ad91ccf6feae44411269cd0ff674714e", 173 "EndpointIP": "10.0.0.4", 174 "Info": { 175 "Host IP": "192.168.33.13" 176 } 177 } 178 ] 179 } 180 } 181 } 182 ] 183 ```