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