github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/docs/reference/commandline/network_inspect.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "network inspect"
     4  description = "The network inspect command description and usage"
     5  keywords = ["network, inspect, user-defined"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # network inspect
    12  
    13      Usage:  docker network inspect [OPTIONS] NETWORK [NETWORK..]
    14  
    15      Displays detailed information on a network
    16  
    17        -f, --format=       Format the output using the given go template.
    18        --help             Print usage
    19  
    20  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:
    21  
    22  ```bash
    23  $ sudo docker run -itd --name=container1 busybox
    24  f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27
    25  
    26  $ sudo docker run -itd --name=container2 busybox
    27  bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727
    28  ```
    29  
    30  The `network inspect` command shows the containers, by id, in its
    31  results. For networks backed by multi-host network driver, such as Overlay,
    32  this command also shows the container endpoints in other hosts in the
    33  cluster. These endpoints are represented as "ep-{endpoint-id}" in the output.
    34  You can specify an alternate format to execute a given
    35  template for each result. Go's
    36  [text/template](http://golang.org/pkg/text/template/) package describes all the
    37  details of the format.
    38  
    39  ```bash
    40  $ sudo docker network inspect bridge
    41  [
    42      {
    43          "Name": "bridge",
    44          "Id": "b2b1a2cba717161d984383fd68218cf70bbbd17d328496885f7c921333228b0f",
    45          "Scope": "local",
    46          "Driver": "bridge",
    47          "IPAM": {
    48              "Driver": "default",
    49              "Config": [
    50                  {
    51                      "Subnet": "172.17.42.1/16",
    52                      "Gateway": "172.17.42.1"
    53                  }
    54              ]
    55          },
    56          "Internal": false,
    57          "Containers": {
    58              "bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727": {
    59                  "Name": "container2",
    60                  "EndpointID": "0aebb8fcd2b282abe1365979536f21ee4ceaf3ed56177c628eae9f706e00e019",
    61                  "MacAddress": "02:42:ac:11:00:02",
    62                  "IPv4Address": "172.17.0.2/16",
    63                  "IPv6Address": ""
    64              },
    65              "f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27": {
    66                  "Name": "container1",
    67                  "EndpointID": "a00676d9c91a96bbe5bcfb34f705387a33d7cc365bac1a29e4e9728df92d10ad",
    68                  "MacAddress": "02:42:ac:11:00:01",
    69                  "IPv4Address": "172.17.0.1/16",
    70                  "IPv6Address": ""
    71              }
    72          },
    73          "Options": {
    74              "com.docker.network.bridge.default_bridge": "true",
    75              "com.docker.network.bridge.enable_icc": "true",
    76              "com.docker.network.bridge.enable_ip_masquerade": "true",
    77              "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
    78              "com.docker.network.bridge.name": "docker0",
    79              "com.docker.network.driver.mtu": "1500"
    80          }
    81      }
    82  ]
    83  ```
    84  
    85  Returns the information about the user-defined network:
    86  
    87  ```bash
    88  $ docker network create simple-network
    89  69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a
    90  $ docker network inspect simple-network
    91  [
    92      {
    93          "Name": "simple-network",
    94          "Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a",
    95          "Scope": "local",
    96          "Driver": "bridge",
    97          "IPAM": {
    98              "Driver": "default",
    99              "Config": [
   100                  {
   101                      "Subnet": "172.22.0.0/16",
   102                      "Gateway": "172.22.0.1/16"
   103                  }
   104              ]
   105          },
   106          "Containers": {},
   107          "Options": {}
   108      }
   109  ]
   110  ```
   111  
   112  ## Related information
   113  
   114  * [network disconnect ](network_disconnect.md)
   115  * [network connect](network_connect.md)
   116  * [network create](network_create.md)
   117  * [network ls](network_ls.md)
   118  * [network rm](network_rm.md)
   119  * [Understand Docker container networks](../../userguide/networking/dockernetworks.md)