github.com/yogeshlonkar/moby@v1.13.2-0.20201203103638-c0b64beaea94/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  ## Description
    29  
    30  Returns information about one or more networks. By default, this command renders
    31  all results in a JSON object.
    32  
    33  ## Examples
    34  
    35  ## Inspect the `bridge` network
    36  
    37  Connect two containers to the default `bridge` network:
    38  
    39  ```bash
    40  $ sudo docker run -itd --name=container1 busybox
    41  f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27
    42  
    43  $ sudo docker run -itd --name=container2 busybox
    44  bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727
    45  ```
    46  
    47  The `network inspect` command shows the containers, by id, in its
    48  results. For networks backed by multi-host network driver, such as Overlay,
    49  this command also shows the container endpoints in other hosts in the
    50  cluster. These endpoints are represented as "ep-{endpoint-id}" in the output.
    51  However, for swarm-scoped networks, only the endpoints that are local to the
    52  node are shown.
    53  
    54  You can specify an alternate format to execute a given
    55  template for each result. Go's
    56  [text/template](http://golang.org/pkg/text/template/) package describes all the
    57  details of the format.
    58  
    59  ```none
    60  $ sudo docker network inspect bridge
    61  
    62  [
    63      {
    64          "Name": "bridge",
    65          "Id": "b2b1a2cba717161d984383fd68218cf70bbbd17d328496885f7c921333228b0f",
    66          "Created": "2016-10-19T04:33:30.360899459Z",
    67          "Scope": "local",
    68          "Driver": "bridge",
    69          "IPAM": {
    70              "Driver": "default",
    71              "Config": [
    72                  {
    73                      "Subnet": "172.17.42.1/16",
    74                      "Gateway": "172.17.42.1"
    75                  }
    76              ]
    77          },
    78          "Internal": false,
    79          "Containers": {
    80              "bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727": {
    81                  "Name": "container2",
    82                  "EndpointID": "0aebb8fcd2b282abe1365979536f21ee4ceaf3ed56177c628eae9f706e00e019",
    83                  "MacAddress": "02:42:ac:11:00:02",
    84                  "IPv4Address": "172.17.0.2/16",
    85                  "IPv6Address": ""
    86              },
    87              "f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27": {
    88                  "Name": "container1",
    89                  "EndpointID": "a00676d9c91a96bbe5bcfb34f705387a33d7cc365bac1a29e4e9728df92d10ad",
    90                  "MacAddress": "02:42:ac:11:00:01",
    91                  "IPv4Address": "172.17.0.1/16",
    92                  "IPv6Address": ""
    93              }
    94          },
    95          "Options": {
    96              "com.docker.network.bridge.default_bridge": "true",
    97              "com.docker.network.bridge.enable_icc": "true",
    98              "com.docker.network.bridge.enable_ip_masquerade": "true",
    99              "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
   100              "com.docker.network.bridge.name": "docker0",
   101              "com.docker.network.driver.mtu": "1500"
   102          },
   103          "Labels": {}
   104      }
   105  ]
   106  ```
   107  
   108  ### Inspect a user-defined network
   109  
   110  Create and inspect a user-defined network:
   111  
   112  ```bash
   113  $ docker network create simple-network
   114  
   115  69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a
   116  ```
   117  
   118  ```none
   119  $ docker network inspect simple-network
   120  
   121  [
   122      {
   123          "Name": "simple-network",
   124          "Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a",
   125          "Created": "2016-10-19T04:33:30.360899459Z",
   126          "Scope": "local",
   127          "Driver": "bridge",
   128          "IPAM": {
   129              "Driver": "default",
   130              "Config": [
   131                  {
   132                      "Subnet": "172.22.0.0/16",
   133                      "Gateway": "172.22.0.1"
   134                  }
   135              ]
   136          },
   137          "Containers": {},
   138          "Options": {},
   139          "Labels": {}
   140      }
   141  ]
   142  ```
   143  
   144  ### Inspect the `ingress` network
   145  
   146  For swarm mode overlay networks `network inspect` also shows the IP address and node name
   147  of the peers. Peers are the nodes in the swarm cluster which have at least one task attached
   148  to the network. Node name is of the format `<hostname>-<unique ID>`.
   149  
   150  ```none
   151  $ docker network inspect ingress
   152  
   153  [
   154      {
   155          "Name": "ingress",
   156          "Id": "j0izitrut30h975vk4m1u5kk3",
   157          "Created": "2016-11-08T06:49:59.803387552Z",
   158          "Scope": "swarm",
   159          "Driver": "overlay",
   160          "EnableIPv6": false,
   161          "IPAM": {
   162              "Driver": "default",
   163              "Options": null,
   164              "Config": [
   165                  {
   166                      "Subnet": "10.255.0.0/16",
   167                      "Gateway": "10.255.0.1"
   168                  }
   169              ]
   170          },
   171          "Internal": false,
   172          "Attachable": false,
   173          "Containers": {
   174              "ingress-sbox": {
   175                  "Name": "ingress-endpoint",
   176                  "EndpointID": "40e002d27b7e5d75f60bc72199d8cae3344e1896abec5eddae9743755fe09115",
   177                  "MacAddress": "02:42:0a:ff:00:03",
   178                  "IPv4Address": "10.255.0.3/16",
   179                  "IPv6Address": ""
   180              }
   181          },
   182          "Options": {
   183              "com.docker.network.driver.overlay.vxlanid_list": "256"
   184          },
   185          "Labels": {},
   186          "Peers": [
   187              {
   188                  "Name": "net-1-1d22adfe4d5c",
   189                  "IP": "192.168.33.11"
   190              },
   191              {
   192                  "Name": "net-2-d55d838b34af",
   193                  "IP": "192.168.33.12"
   194              },
   195              {
   196                  "Name": "net-3-8473f8140bd9",
   197                  "IP": "192.168.33.13"
   198              }
   199          ]
   200      }
   201  ]
   202  ```
   203  
   204  ## Related commands
   205  
   206  * [network disconnect ](network_disconnect.md)
   207  * [network connect](network_connect.md)
   208  * [network create](network_create.md)
   209  * [network ls](network_ls.md)
   210  * [network rm](network_rm.md)
   211  * [network prune](network_prune.md)
   212  * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/)