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

     1  <!--[metadata]>
     2  +++
     3  title = "network ls"
     4  description = "The network ls command description and usage"
     5  keywords = ["network, list, user-defined"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # docker network ls
    12  
    13      Usage:  docker network ls [OPTIONS]
    14  
    15      Lists all the networks created by the user
    16        -f, --filter=[]       Filter output based on conditions provided
    17        --help                Print usage
    18        --no-trunc            Do not truncate the output
    19        -q, --quiet           Only display numeric IDs
    20  
    21  Lists all the networks the Engine `daemon` knows about. This includes the
    22  networks that span across multiple hosts in a cluster, for example:
    23  
    24  ```bash
    25      $ sudo docker network ls
    26      NETWORK ID          NAME                DRIVER
    27      7fca4eb8c647        bridge              bridge
    28      9f904ee27bf5        none                null
    29      cf03ee007fb4        host                host
    30      78b03ee04fc4        multi-host          overlay
    31  ```
    32  
    33  Use the `--no-trunc` option to display the full network id:
    34  
    35  ```bash
    36  docker network ls --no-trunc
    37  NETWORK ID                                                         NAME                DRIVER
    38  18a2866682b85619a026c81b98a5e375bd33e1b0936a26cc497c283d27bae9b3   none                null                
    39  c288470c46f6c8949c5f7e5099b5b7947b07eabe8d9a27d79a9cbf111adcbf47   host                host                
    40  7b369448dccbf865d397c8d2be0cda7cf7edc6b0945f77d2529912ae917a0185   bridge              bridge              
    41  95e74588f40db048e86320c6526440c504650a1ff3e9f7d60a497c4d2163e5bd   foo                 bridge    
    42  63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161   dev                 bridge
    43  ```
    44  
    45  ## Filtering
    46  
    47  The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there
    48  is more than one filter, then pass multiple flags (e.g. `--filter "foo=bar" --filter "bif=baz"`).
    49  Multiple filter flags are combined as an `OR` filter. For example, 
    50  `-f type=custom -f type=builtin` returns both `custom` and `builtin` networks.
    51  
    52  The currently supported filters are:
    53  
    54  * id (network's id)
    55  * name (network's name)
    56  * type (custom|builtin)
    57  
    58  #### Type
    59  
    60  The `type` filter supports two values; `builtin` displays predefined networks
    61  (`bridge`, `none`, `host`), whereas `custom` displays user defined networks.
    62  
    63  The following filter matches all user defined networks:
    64  
    65  ```bash
    66  $ docker network ls --filter type=custom
    67  NETWORK ID          NAME                DRIVER
    68  95e74588f40d        foo                 bridge
    69  63d1ff1f77b0        dev                 bridge
    70  ```
    71  
    72  By having this flag it allows for batch cleanup. For example, use this filter
    73  to delete all user defined networks:
    74  
    75  ```bash
    76  $ docker network rm `docker network ls --filter type=custom -q`
    77  ```
    78  
    79  A warning will be issued when trying to remove a network that has containers
    80  attached.
    81  
    82  #### Name
    83  
    84  The `name` filter matches on all or part of a network's name.
    85  
    86  The following filter matches all networks with a name containing the `foobar` string.
    87  
    88  ```bash
    89  $ docker network ls --filter name=foobar
    90  NETWORK ID          NAME                DRIVER
    91  06e7eef0a170        foobar              bridge
    92  ```
    93  
    94  You can also filter for a substring in a name as this shows:
    95  
    96  ```bash
    97  $ docker network ls --filter name=foo
    98  NETWORK ID          NAME                DRIVER
    99  95e74588f40d        foo                 bridge
   100  06e7eef0a170        foobar              bridge
   101  ```
   102  
   103  #### ID
   104  
   105  The `id` filter matches on all or part of a network's ID.
   106  
   107  The following filter matches all networks with an ID containing the
   108  `63d1ff1f77b0...` string.
   109  
   110  ```bash
   111  $ docker network ls --filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161
   112  NETWORK ID          NAME                DRIVER
   113  63d1ff1f77b0        dev                 bridge
   114  ```
   115  
   116  You can also filter for a substring in an ID as this shows:
   117  
   118  ```bash
   119  $ docker network ls --filter id=95e74588f40d
   120  NETWORK ID          NAME                DRIVER
   121  95e74588f40d        foo                 bridge
   122  
   123  $ docker network ls --filter id=95e
   124  NETWORK ID          NAME                DRIVER
   125  95e74588f40d        foo                 bridge
   126  ```
   127  
   128  ## Related information
   129  
   130  * [network disconnect ](network_disconnect.md)
   131  * [network connect](network_connect.md)
   132  * [network create](network_create.md)
   133  * [network inspect](network_inspect.md)
   134  * [network rm](network_rm.md)
   135  * [Understand Docker container networks](../../userguide/networking/dockernetworks.md)