github.com/fabiokung/docker@v0.11.2-0.20170222101415-4534dcd49497/docs/reference/commandline/network_prune.md (about) 1 --- 2 title: "network prune" 3 description: "Remove unused networks" 4 keywords: "network, prune, delete" 5 --- 6 7 # network prune 8 9 ```markdown 10 Usage: docker network prune [OPTIONS] 11 12 Remove all unused networks 13 14 Options: 15 --filter filter Provide filter values (e.g. 'until=<timestamp>') 16 -f, --force Do not prompt for confirmation 17 --help Print usage 18 ``` 19 20 ## Description 21 22 Remove all unused networks. Unused networks are those which are not referenced 23 by any containers. 24 25 ## Examples 26 27 ```bash 28 $ docker network prune 29 30 WARNING! This will remove all networks not used by at least one container. 31 Are you sure you want to continue? [y/N] y 32 Deleted Networks: 33 n1 34 n2 35 ``` 36 37 ### Filtering 38 39 The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more 40 than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`) 41 42 The currently supported filters are: 43 44 * until (`<timestamp>`) - only remove networks created before given timestamp 45 46 The `until` filter can be Unix timestamps, date formatted 47 timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed 48 relative to the daemon machine’s time. Supported formats for date 49 formatted time stamps include RFC3339Nano, RFC3339, `2006-01-02T15:04:05`, 50 `2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local 51 timezone on the daemon will be used if you do not provide either a `Z` or a 52 `+-00:00` timezone offset at the end of the timestamp. When providing Unix 53 timestamps enter seconds[.nanoseconds], where seconds is the number of seconds 54 that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap 55 seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a 56 fraction of a second no more than nine digits long. 57 58 The following removes networks created more than 5 minutes ago. Note that 59 system networks such as `bridge`, `host`, and `none` will never be pruned: 60 61 ```none 62 $ docker network ls 63 64 NETWORK ID NAME DRIVER SCOPE 65 7430df902d7a bridge bridge local 66 ea92373fd499 foo-1-day-ago bridge local 67 ab53663ed3c7 foo-1-min-ago bridge local 68 97b91972bc3b host host local 69 f949d337b1f5 none null local 70 71 $ docker network prune --force --filter until=5m 72 73 Deleted Networks: 74 foo-1-day-ago 75 76 $ docker network ls 77 78 NETWORK ID NAME DRIVER SCOPE 79 7430df902d7a bridge bridge local 80 ab53663ed3c7 foo-1-min-ago bridge local 81 97b91972bc3b host host local 82 f949d337b1f5 none null local 83 ``` 84 85 ## Related commands 86 87 * [network disconnect ](network_disconnect.md) 88 * [network connect](network_connect.md) 89 * [network create](network_create.md) 90 * [network ls](network_ls.md) 91 * [network inspect](network_inspect.md) 92 * [network rm](network_rm.md) 93 * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/) 94 * [system df](system_df.md) 95 * [container prune](container_prune.md) 96 * [image prune](image_prune.md) 97 * [volume prune](volume_prune.md) 98 * [system prune](system_prune.md)