github.com/dpiddy/docker@v1.12.2-rc1/man/docker-network-ls.1.md (about)

     1  % DOCKER(1) Docker User Manuals
     2  % Docker Community
     3  % OCT 2015
     4  # NAME
     5  docker-network-ls - list networks
     6  
     7  # SYNOPSIS
     8  **docker network ls**
     9  [**-f**|**--filter**[=*[]*]]
    10  [**--no-trunc**[=*true*|*false*]]
    11  [**-q**|**--quiet**[=*true*|*false*]]
    12  [**--help**]
    13  
    14  # DESCRIPTION
    15  
    16  Lists all the networks the Engine `daemon` knows about. This includes the
    17  networks that span across multiple hosts in a cluster, for example:
    18  
    19  ```bash
    20      $ docker network ls
    21      NETWORK ID          NAME                DRIVER
    22      7fca4eb8c647        bridge              bridge
    23      9f904ee27bf5        none                null
    24      cf03ee007fb4        host                host
    25      78b03ee04fc4        multi-host          overlay
    26  ```
    27  
    28  Use the `--no-trunc` option to display the full network id:
    29  
    30  ```bash
    31  $ docker network ls --no-trunc
    32  NETWORK ID                                                         NAME                DRIVER
    33  18a2866682b85619a026c81b98a5e375bd33e1b0936a26cc497c283d27bae9b3   none                null                
    34  c288470c46f6c8949c5f7e5099b5b7947b07eabe8d9a27d79a9cbf111adcbf47   host                host                
    35  7b369448dccbf865d397c8d2be0cda7cf7edc6b0945f77d2529912ae917a0185   bridge              bridge              
    36  95e74588f40db048e86320c6526440c504650a1ff3e9f7d60a497c4d2163e5bd   foo                 bridge    
    37  63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161   dev                 bridge
    38  ```
    39  
    40  ## Filtering
    41  
    42  The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there
    43  is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`).
    44  Multiple filter flags are combined as an `OR` filter. For example, 
    45  `-f type=custom -f type=builtin` returns both `custom` and `builtin` networks.
    46  
    47  The currently supported filters are:
    48  
    49  * driver
    50  * id (network's id)
    51  * label (`label=<key>` or `label=<key>=<value>`)
    52  * name (network's name)
    53  * type (custom|builtin)
    54  
    55  #### Driver
    56  
    57  The `driver` filter matches networks based on their driver.
    58  
    59  The following example matches networks with the `bridge` driver:
    60  
    61  ```bash
    62  $ docker network ls --filter driver=bridge
    63  NETWORK ID          NAME                DRIVER
    64  db9db329f835        test1               bridge
    65  f6e212da9dfd        test2               bridge
    66  ```
    67  
    68  #### ID
    69  
    70  The `id` filter matches on all or part of a network's ID.
    71  
    72  The following filter matches all networks with an ID containing the
    73  `63d1ff1f77b0...` string.
    74  
    75  ```bash
    76  $ docker network ls --filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161
    77  NETWORK ID          NAME                DRIVER
    78  63d1ff1f77b0        dev                 bridge
    79  ```
    80  
    81  You can also filter for a substring in an ID as this shows:
    82  
    83  ```bash
    84  $ docker network ls --filter id=95e74588f40d
    85  NETWORK ID          NAME                DRIVER
    86  95e74588f40d        foo                 bridge
    87  
    88  $ docker network ls --filter id=95e
    89  NETWORK ID          NAME                DRIVER
    90  95e74588f40d        foo                 bridge
    91  ```
    92  
    93  #### Label
    94  
    95  The `label` filter matches networks based on the presence of a `label` alone or a `label` and a
    96  value.
    97  
    98  The following filter matches networks with the `usage` label regardless of its value.
    99  
   100  ```bash
   101  $ docker network ls -f "label=usage"
   102  NETWORK ID          NAME                DRIVER
   103  db9db329f835        test1               bridge              
   104  f6e212da9dfd        test2               bridge
   105  ```
   106  
   107  The following filter matches networks with the `usage` label with the `prod` value.
   108  
   109  ```bash
   110  $ docker network ls -f "label=usage=prod"
   111  NETWORK ID          NAME                DRIVER
   112  f6e212da9dfd        test2               bridge
   113  ```
   114  
   115  #### Name
   116  
   117  The `name` filter matches on all or part of a network's name.
   118  
   119  The following filter matches all networks with a name containing the `foobar` string.
   120  
   121  ```bash
   122  $ docker network ls --filter name=foobar
   123  NETWORK ID          NAME                DRIVER
   124  06e7eef0a170        foobar              bridge
   125  ```
   126  
   127  You can also filter for a substring in a name as this shows:
   128  
   129  ```bash
   130  $ docker network ls --filter name=foo
   131  NETWORK ID          NAME                DRIVER
   132  95e74588f40d        foo                 bridge
   133  06e7eef0a170        foobar              bridge
   134  ```
   135  
   136  #### Type
   137  
   138  The `type` filter supports two values; `builtin` displays predefined networks
   139  (`bridge`, `none`, `host`), whereas `custom` displays user defined networks.
   140  
   141  The following filter matches all user defined networks:
   142  
   143  ```bash
   144  $ docker network ls --filter type=custom
   145  NETWORK ID          NAME                DRIVER
   146  95e74588f40d        foo                 bridge
   147  63d1ff1f77b0        dev                 bridge
   148  ```
   149  
   150  By having this flag it allows for batch cleanup. For example, use this filter
   151  to delete all user defined networks:
   152  
   153  ```bash
   154  $ docker network rm `docker network ls --filter type=custom -q`
   155  ```
   156  
   157  A warning will be issued when trying to remove a network that has containers
   158  attached.
   159  
   160  # OPTIONS
   161  
   162  **-f**, **--filter**=*[]*
   163    filter output based on conditions provided. 
   164  
   165  **--no-trunc**=*true*|*false*
   166    Do not truncate the output
   167  
   168  **-q**, **--quiet**=*true*|*false*
   169    Only display network IDs
   170  
   171  **--help**
   172    Print usage statement
   173  
   174  # HISTORY
   175  OCT 2015, created by Mary Anthony <mary@docker.com>