github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/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 * type (custom|builtin) 39 40 #### Driver 41 42 The `driver` filter matches networks based on their driver. 43 44 The following example matches networks with the `bridge` driver: 45 46 ```bash 47 $ docker network ls --filter driver=bridge 48 NETWORK ID NAME DRIVER 49 db9db329f835 test1 bridge 50 f6e212da9dfd test2 bridge 51 ``` 52 53 #### ID 54 55 The `id` filter matches on all or part of a network's ID. 56 57 The following filter matches all networks with an ID containing the 58 `63d1ff1f77b0...` string. 59 60 ```bash 61 $ docker network ls --filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161 62 NETWORK ID NAME DRIVER 63 63d1ff1f77b0 dev bridge 64 ``` 65 66 You can also filter for a substring in an ID as this shows: 67 68 ```bash 69 $ docker network ls --filter id=95e74588f40d 70 NETWORK ID NAME DRIVER 71 95e74588f40d foo bridge 72 73 $ docker network ls --filter id=95e 74 NETWORK ID NAME DRIVER 75 95e74588f40d foo bridge 76 ``` 77 78 #### Label 79 80 The `label` filter matches networks based on the presence of a `label` alone or a `label` and a 81 value. 82 83 The following filter matches networks with the `usage` label regardless of its value. 84 85 ```bash 86 $ docker network ls -f "label=usage" 87 NETWORK ID NAME DRIVER 88 db9db329f835 test1 bridge 89 f6e212da9dfd test2 bridge 90 ``` 91 92 The following filter matches networks with the `usage` label with the `prod` value. 93 94 ```bash 95 $ docker network ls -f "label=usage=prod" 96 NETWORK ID NAME DRIVER 97 f6e212da9dfd test2 bridge 98 ``` 99 100 #### Name 101 102 The `name` filter matches on all or part of a network's name. 103 104 The following filter matches all networks with a name containing the `foobar` string. 105 106 ```bash 107 $ docker network ls --filter name=foobar 108 NETWORK ID NAME DRIVER 109 06e7eef0a170 foobar bridge 110 ``` 111 112 You can also filter for a substring in a name as this shows: 113 114 ```bash 115 $ docker network ls --filter name=foo 116 NETWORK ID NAME DRIVER 117 95e74588f40d foo bridge 118 06e7eef0a170 foobar bridge 119 ``` 120 121 #### Type 122 123 The `type` filter supports two values; `builtin` displays predefined networks 124 (`bridge`, `none`, `host`), whereas `custom` displays user defined networks. 125 126 The following filter matches all user defined networks: 127 128 ```bash 129 $ docker network ls --filter type=custom 130 NETWORK ID NAME DRIVER 131 95e74588f40d foo bridge 132 63d1ff1f77b0 dev bridge 133 ``` 134 135 By having this flag it allows for batch cleanup. For example, use this filter 136 to delete all user defined networks: 137 138 ```bash 139 $ docker network rm `docker network ls --filter type=custom -q` 140 ``` 141 142 A warning will be issued when trying to remove a network that has containers 143 attached. 144 145 ## Format 146 147 Format uses a Go template to print the output. The following variables are 148 supported: 149 150 * .ID - Network ID 151 * .Name - Network name 152 * .Driver - Network driver 153 * .Scope - Network scope (local, global) 154 * .IPv6 - Whether IPv6 is enabled on the network or not 155 * .Internal - Whether the network is internal or not 156 * .Labels - All labels assigned to the network 157 * .Label - Value of a specific label for this network. For example `{{.Label "project.version"}}`