github.com/kobeld/docker@v1.12.0-rc1/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 * driver 55 * id (network's id) 56 * label (`label=<key>` or `label=<key>=<value>`) 57 * name (network's name) 58 * type (custom|builtin) 59 60 #### Driver 61 62 The `driver` filter matches networks based on their driver. 63 64 The following example matches networks with the `bridge` driver: 65 66 ```bash 67 $ docker network ls --filter driver=bridge 68 NETWORK ID NAME DRIVER 69 db9db329f835 test1 bridge 70 f6e212da9dfd test2 bridge 71 ``` 72 73 #### ID 74 75 The `id` filter matches on all or part of a network's ID. 76 77 The following filter matches all networks with an ID containing the 78 `63d1ff1f77b0...` string. 79 80 ```bash 81 $ docker network ls --filter id=63d1ff1f77b07ca51070a8c227e962238358bd310bde1529cf62e6c307ade161 82 NETWORK ID NAME DRIVER 83 63d1ff1f77b0 dev bridge 84 ``` 85 86 You can also filter for a substring in an ID as this shows: 87 88 ```bash 89 $ docker network ls --filter id=95e74588f40d 90 NETWORK ID NAME DRIVER 91 95e74588f40d foo bridge 92 93 $ docker network ls --filter id=95e 94 NETWORK ID NAME DRIVER 95 95e74588f40d foo bridge 96 ``` 97 98 #### Label 99 100 The `label` filter matches networks based on the presence of a `label` alone or a `label` and a 101 value. 102 103 The following filter matches networks with the `usage` label regardless of its value. 104 105 ```bash 106 $ docker network ls -f "label=usage" 107 NETWORK ID NAME DRIVER 108 db9db329f835 test1 bridge 109 f6e212da9dfd test2 bridge 110 ``` 111 112 The following filter matches networks with the `usage` label with the `prod` value. 113 114 ```bash 115 $ docker network ls -f "label=usage=prod" 116 NETWORK ID NAME DRIVER 117 f6e212da9dfd test2 bridge 118 ``` 119 120 #### Name 121 122 The `name` filter matches on all or part of a network's name. 123 124 The following filter matches all networks with a name containing the `foobar` string. 125 126 ```bash 127 $ docker network ls --filter name=foobar 128 NETWORK ID NAME DRIVER 129 06e7eef0a170 foobar bridge 130 ``` 131 132 You can also filter for a substring in a name as this shows: 133 134 ```bash 135 $ docker network ls --filter name=foo 136 NETWORK ID NAME DRIVER 137 95e74588f40d foo bridge 138 06e7eef0a170 foobar bridge 139 ``` 140 141 #### Type 142 143 The `type` filter supports two values; `builtin` displays predefined networks 144 (`bridge`, `none`, `host`), whereas `custom` displays user defined networks. 145 146 The following filter matches all user defined networks: 147 148 ```bash 149 $ docker network ls --filter type=custom 150 NETWORK ID NAME DRIVER 151 95e74588f40d foo bridge 152 63d1ff1f77b0 dev bridge 153 ``` 154 155 By having this flag it allows for batch cleanup. For example, use this filter 156 to delete all user defined networks: 157 158 ```bash 159 $ docker network rm `docker network ls --filter type=custom -q` 160 ``` 161 162 A warning will be issued when trying to remove a network that has containers 163 attached. 164 165 ## Related information 166 167 * [network disconnect ](network_disconnect.md) 168 * [network connect](network_connect.md) 169 * [network create](network_create.md) 170 * [network inspect](network_inspect.md) 171 * [network rm](network_rm.md) 172 * [Understand Docker container networks](../../userguide/networking/dockernetworks.md)