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