github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/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  # network inspect
     8  
     9  ```markdown
    10  Usage:  docker network inspect [OPTIONS] NETWORK [NETWORK...]
    11  
    12  Display detailed information on one or more networks
    13  
    14  Options:
    15    -f, --format string   Format the output using the given Go template
    16        --help            Print usage
    17  ```
    18  
    19  ## Description
    20  
    21  Returns information about one or more networks. By default, this command renders
    22  all results in a JSON object.
    23  
    24  ## Examples
    25  
    26  ## Inspect the `bridge` network
    27  
    28  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 mode 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  The output is in JSON format, for example:
    55  
    56  ```json
    57  [
    58    {
    59      "Name": "bridge",
    60      "Id": "b2b1a2cba717161d984383fd68218cf70bbbd17d328496885f7c921333228b0f",
    61      "Created": "2016-10-19T04:33:30.360899459Z",
    62      "Scope": "local",
    63      "Driver": "bridge",
    64      "IPAM": {
    65        "Driver": "default",
    66        "Config": [
    67          {
    68            "Subnet": "172.17.42.1/16",
    69            "Gateway": "172.17.42.1"
    70          }
    71        ]
    72      },
    73      "Internal": false,
    74      "Containers": {
    75        "bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727": {
    76          "Name": "container2",
    77          "EndpointID": "0aebb8fcd2b282abe1365979536f21ee4ceaf3ed56177c628eae9f706e00e019",
    78          "MacAddress": "02:42:ac:11:00:02",
    79          "IPv4Address": "172.17.0.2/16",
    80          "IPv6Address": ""
    81        },
    82        "f2870c98fd504370fb86e59f32cd0753b1ac9b69b7d80566ffc7192a82b3ed27": {
    83          "Name": "container1",
    84          "EndpointID": "a00676d9c91a96bbe5bcfb34f705387a33d7cc365bac1a29e4e9728df92d10ad",
    85          "MacAddress": "02:42:ac:11:00:01",
    86          "IPv4Address": "172.17.0.1/16",
    87          "IPv6Address": ""
    88        }
    89      },
    90      "Options": {
    91        "com.docker.network.bridge.default_bridge": "true",
    92        "com.docker.network.bridge.enable_icc": "true",
    93        "com.docker.network.bridge.enable_ip_masquerade": "true",
    94        "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
    95        "com.docker.network.bridge.name": "docker0",
    96        "com.docker.network.driver.mtu": "1500"
    97      },
    98      "Labels": {}
    99    }
   100  ]
   101  ```
   102  
   103  ### Inspect a user-defined network
   104  
   105  Create and inspect a user-defined network:
   106  
   107  ```bash
   108  $ docker network create simple-network
   109  
   110  69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a
   111  ```
   112  
   113  ```bash
   114  $ docker network inspect simple-network
   115  ```
   116  
   117  The output is in JSON format, for example:
   118  
   119  ```json
   120  [
   121    {
   122      "Name": "simple-network",
   123      "Id": "69568e6336d8c96bbf57869030919f7c69524f71183b44d80948bd3927c87f6a",
   124      "Created": "2016-10-19T04:33:30.360899459Z",
   125      "Scope": "local",
   126      "Driver": "bridge",
   127      "IPAM": {
   128        "Driver": "default",
   129        "Config": [
   130          {
   131            "Subnet": "172.22.0.0/16",
   132            "Gateway": "172.22.0.1"
   133          }
   134        ]
   135      },
   136      "Containers": {},
   137      "Options": {},
   138      "Labels": {}
   139    }
   140  ]
   141  ```
   142  
   143  ### Inspect the `ingress` network
   144  
   145  For swarm mode overlay networks `network inspect` also shows the IP address and node name
   146  of the peers. Peers are the nodes in the swarm cluster which have at least one task attached
   147  to the network. Node name is of the format `<hostname>-<unique ID>`.
   148  
   149  ```bash
   150  $ docker network inspect ingress
   151  ```
   152  
   153  The output is in JSON format, for example:
   154  
   155  ```json
   156  [
   157    {
   158      "Name": "ingress",
   159      "Id": "j0izitrut30h975vk4m1u5kk3",
   160      "Created": "2016-11-08T06:49:59.803387552Z",
   161      "Scope": "swarm",
   162      "Driver": "overlay",
   163      "EnableIPv6": false,
   164      "IPAM": {
   165        "Driver": "default",
   166        "Options": null,
   167        "Config": [
   168          {
   169            "Subnet": "10.255.0.0/16",
   170            "Gateway": "10.255.0.1"
   171          }
   172        ]
   173      },
   174      "Internal": false,
   175      "Attachable": false,
   176      "Containers": {
   177        "ingress-sbox": {
   178          "Name": "ingress-endpoint",
   179          "EndpointID": "40e002d27b7e5d75f60bc72199d8cae3344e1896abec5eddae9743755fe09115",
   180          "MacAddress": "02:42:0a:ff:00:03",
   181          "IPv4Address": "10.255.0.3/16",
   182          "IPv6Address": ""
   183        }
   184      },
   185      "Options": {
   186        "com.docker.network.driver.overlay.vxlanid_list": "256"
   187      },
   188      "Labels": {},
   189      "Peers": [
   190        {
   191          "Name": "net-1-1d22adfe4d5c",
   192          "IP": "192.168.33.11"
   193        },
   194        {
   195          "Name": "net-2-d55d838b34af",
   196          "IP": "192.168.33.12"
   197        },
   198        {
   199          "Name": "net-3-8473f8140bd9",
   200          "IP": "192.168.33.13"
   201        }
   202      ]
   203    }
   204  ]
   205  ```
   206  
   207  ### Using `verbose` option for `network inspect`
   208  
   209  `docker network inspect --verbose` for swarm mode overlay networks shows service-specific
   210  details such as the service's VIP and port mappings. It also shows IPs of service tasks,
   211  and the IPs of the nodes where the tasks are running.
   212  
   213  Following is an example output for an overlay network `ov1` that has one service `s1`
   214  attached to. service `s1` in this case has three replicas.
   215  
   216  ```bash
   217  $ docker network inspect --verbose ov1
   218  ```
   219  
   220  The output is in JSON format, for example:
   221  
   222  ```json
   223  [
   224    {
   225      "Name": "ov1",
   226      "Id": "ybmyjvao9vtzy3oorxbssj13b",
   227      "Created": "2017-03-13T17:04:39.776106792Z",
   228      "Scope": "swarm",
   229      "Driver": "overlay",
   230      "EnableIPv6": false,
   231      "IPAM": {
   232        "Driver": "default",
   233        "Options": null,
   234        "Config": [
   235          {
   236            "Subnet": "10.0.0.0/24",
   237            "Gateway": "10.0.0.1"
   238          }
   239        ]
   240      },
   241      "Internal": false,
   242      "Attachable": false,
   243      "Containers": {
   244        "020403bd88a15f60747fd25d1ad5fa1272eb740e8a97fc547d8ad07b2f721c5e": {
   245          "Name": "s1.1.pjn2ik0sfgkfzed3h0s00gs9o",
   246          "EndpointID": "ad16946f416562d658f3bb30b9830d73ad91ccf6feae44411269cd0ff674714e",
   247          "MacAddress": "02:42:0a:00:00:04",
   248          "IPv4Address": "10.0.0.4/24",
   249          "IPv6Address": ""
   250        }
   251      },
   252      "Options": {
   253        "com.docker.network.driver.overlay.vxlanid_list": "4097"
   254      },
   255      "Labels": {},
   256      "Peers": [
   257        {
   258          "Name": "net-3-5d3cfd30a58c",
   259          "IP": "192.168.33.13"
   260        },
   261        {
   262          "Name": "net-1-6ecbc0040a73",
   263          "IP": "192.168.33.11"
   264        },
   265        {
   266          "Name": "net-2-fb80208efd75",
   267          "IP": "192.168.33.12"
   268        }
   269      ],
   270      "Services": {
   271        "s1": {
   272          "VIP": "10.0.0.2",
   273          "Ports": [],
   274          "LocalLBIndex": 257,
   275          "Tasks": [
   276            {
   277              "Name": "s1.2.q4hcq2aiiml25ubtrtg4q1txt",
   278              "EndpointID": "040879b027e55fb658e8b60ae3b87c6cdac7d291e86a190a3b5ac6567b26511a",
   279              "EndpointIP": "10.0.0.5",
   280              "Info": {
   281                "Host IP": "192.168.33.11"
   282              }
   283            },
   284            {
   285              "Name": "s1.3.yawl4cgkp7imkfx469kn9j6lm",
   286              "EndpointID": "106edff9f120efe44068b834e1cddb5b39dd4a3af70211378b2f7a9e562bbad8",
   287              "EndpointIP": "10.0.0.3",
   288              "Info": {
   289                "Host IP": "192.168.33.12"
   290              }
   291            },
   292            {
   293              "Name": "s1.1.pjn2ik0sfgkfzed3h0s00gs9o",
   294              "EndpointID": "ad16946f416562d658f3bb30b9830d73ad91ccf6feae44411269cd0ff674714e",
   295              "EndpointIP": "10.0.0.4",
   296              "Info": {
   297                "Host IP": "192.168.33.13"
   298              }
   299            }
   300          ]
   301        }
   302      }
   303    }
   304  ]
   305  ```
   306  
   307  ## Related commands
   308  
   309  * [network disconnect ](network_disconnect.md)
   310  * [network connect](network_connect.md)
   311  * [network create](network_create.md)
   312  * [network ls](network_ls.md)
   313  * [network rm](network_rm.md)
   314  * [network prune](network_prune.md)
   315  * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/)