From 8f0be436cdf292de88a26d2d2774807a8e88cbbe Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Tue, 18 Oct 2016 04:36:52 +0000 Subject: [PATCH] add `docker network prune` `docker network prune` prunes unused networks, including overlay ones. `docker system prune` also prunes unused networks. Signed-off-by: Akihiro Suda --- docs/reference/commandline/container_prune.md | 1 + docs/reference/commandline/image_prune.md | 1 + docs/reference/commandline/network_connect.md | 1 + docs/reference/commandline/network_create.md | 1 + .../commandline/network_disconnect.md | 1 + docs/reference/commandline/network_inspect.md | 1 + docs/reference/commandline/network_ls.md | 1 + docs/reference/commandline/network_prune.md | 45 +++++++++++++++++++ docs/reference/commandline/network_rm.md | 1 + docs/reference/commandline/system_df.md | 3 ++ docs/reference/commandline/system_prune.md | 4 +- docs/reference/commandline/volume_prune.md | 1 + 12 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 docs/reference/commandline/network_prune.md diff --git a/docs/reference/commandline/container_prune.md b/docs/reference/commandline/container_prune.md index c63324d3ed..3332d7653d 100644 --- a/docs/reference/commandline/container_prune.md +++ b/docs/reference/commandline/container_prune.md @@ -43,4 +43,5 @@ Total reclaimed space: 212 B * [system df](system_df.md) * [volume prune](volume_prune.md) * [image prune](image_prune.md) +* [network prune](network_prune.md) * [system prune](system_prune.md) diff --git a/docs/reference/commandline/image_prune.md b/docs/reference/commandline/image_prune.md index 98c7c4bdf5..5620bd6b5c 100644 --- a/docs/reference/commandline/image_prune.md +++ b/docs/reference/commandline/image_prune.md @@ -67,4 +67,5 @@ Total reclaimed space: 16.43 MB * [system df](system_df.md) * [container prune](container_prune.md) * [volume prune](volume_prune.md) +* [network prune](network_prune.md) * [system prune](system_prune.md) diff --git a/docs/reference/commandline/network_connect.md b/docs/reference/commandline/network_connect.md index 68851f417f..b4a79fc497 100644 --- a/docs/reference/commandline/network_connect.md +++ b/docs/reference/commandline/network_connect.md @@ -98,5 +98,6 @@ You can connect a container to one or more networks. The networks need not be th * [network disconnect](network_disconnect.md) * [network ls](network_ls.md) * [network rm](network_rm.md) +* [network prune](network_prune.md) * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/) * [Work with networks](https://docs.docker.com/engine/userguide/networking/work-with-networks/) diff --git a/docs/reference/commandline/network_create.md b/docs/reference/commandline/network_create.md index 03b891914c..4273207ea8 100644 --- a/docs/reference/commandline/network_create.md +++ b/docs/reference/commandline/network_create.md @@ -197,4 +197,5 @@ to create an externally isolated `overlay` network, you can specify the * [network disconnect](network_disconnect.md) * [network ls](network_ls.md) * [network rm](network_rm.md) +* [network prune](network_prune.md) * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/) diff --git a/docs/reference/commandline/network_disconnect.md b/docs/reference/commandline/network_disconnect.md index f90ea960e6..1f6a00bf45 100644 --- a/docs/reference/commandline/network_disconnect.md +++ b/docs/reference/commandline/network_disconnect.md @@ -39,4 +39,5 @@ Disconnects a container from a network. The container must be running to disconn * [network create](network_create.md) * [network ls](network_ls.md) * [network rm](network_rm.md) +* [network prune](network_prune.md) * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/) diff --git a/docs/reference/commandline/network_inspect.md b/docs/reference/commandline/network_inspect.md index 85d40453c1..32754ddd7d 100644 --- a/docs/reference/commandline/network_inspect.md +++ b/docs/reference/commandline/network_inspect.md @@ -131,4 +131,5 @@ $ docker network inspect simple-network * [network create](network_create.md) * [network ls](network_ls.md) * [network rm](network_rm.md) +* [network prune](network_prune.md) * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/) diff --git a/docs/reference/commandline/network_ls.md b/docs/reference/commandline/network_ls.md index a8fc68ca13..cf3bab6452 100644 --- a/docs/reference/commandline/network_ls.md +++ b/docs/reference/commandline/network_ls.md @@ -214,4 +214,5 @@ d1584f8dc718: host * [network create](network_create.md) * [network inspect](network_inspect.md) * [network rm](network_rm.md) +* [network prune](network_prune.md) * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/) diff --git a/docs/reference/commandline/network_prune.md b/docs/reference/commandline/network_prune.md new file mode 100644 index 0000000000..82da94e31c --- /dev/null +++ b/docs/reference/commandline/network_prune.md @@ -0,0 +1,45 @@ +--- +title: "network prune" +description: "Remove unused networks" +keywords: [network, prune, delete] +--- + +# network prune + +```markdown +Usage: docker network prune [OPTIONS] + +Remove all unused networks + +Options: + -f, --force Do not prompt for confirmation + --help Print usage +``` + +Remove all unused networks. Unused networks are those which are not referenced by any containers. + +Example output: + +```bash +$ docker network prune +WARNING! This will remove all networks not used by at least one container. +Are you sure you want to continue? [y/N] y +Deleted Networks: +n1 +n2 +``` + +## Related information + +* [network disconnect ](network_disconnect.md) +* [network connect](network_connect.md) +* [network create](network_create.md) +* [network ls](network_ls.md) +* [network inspect](network_inspect.md) +* [network rm](network_rm.md) +* [Understand Docker container networks](../../userguide/networking/index.md) +* [system df](system_df.md) +* [container prune](container_prune.md) +* [image prune](image_prune.md) +* [volume prune](volume_prune.md) +* [system prune](system_prune.md) diff --git a/docs/reference/commandline/network_rm.md b/docs/reference/commandline/network_rm.md index a806983610..d2bce4e0f0 100644 --- a/docs/reference/commandline/network_rm.md +++ b/docs/reference/commandline/network_rm.md @@ -55,4 +55,5 @@ deletion. * [network create](network_create.md) * [network ls](network_ls.md) * [network inspect](network_inspect.md) +* [network prune](network_prune.md) * [Understand Docker container networks](https://docs.docker.com/engine/userguide/networking/) diff --git a/docs/reference/commandline/system_df.md b/docs/reference/commandline/system_df.md index 044f5e4b66..10cd1b40a0 100644 --- a/docs/reference/commandline/system_df.md +++ b/docs/reference/commandline/system_df.md @@ -66,8 +66,11 @@ my-named-vol 0 * `UNIQUE SIZE` is the amount of space that is only used by a given image * `SIZE` is the virtual size of the image, it is the sum of `SHARED SIZE` and `UNIQUE SIZE` +Note that network information is not shown because it doesn't consume the disk space. + ## Related Information * [system prune](system_prune.md) * [container prune](container_prune.md) * [volume prune](volume_prune.md) * [image prune](image_prune.md) +* [network prune](network_prune.md) diff --git a/docs/reference/commandline/system_prune.md b/docs/reference/commandline/system_prune.md index 862b64d1f1..3f0c97478a 100644 --- a/docs/reference/commandline/system_prune.md +++ b/docs/reference/commandline/system_prune.md @@ -26,7 +26,7 @@ Options: --help Print usage ``` -Remove all unused containers, volumes and images (both dangling and unreferenced). +Remove all unused containers, volumes, networks and images (both dangling and unreferenced). Example output: @@ -35,6 +35,7 @@ $ docker system prune -a WARNING! This will remove: - all stopped containers - all volumes not used by at least one container + - all networks not used by at least one container - all images without at least one container associated to them Are you sure you want to continue? [y/N] y Deleted Containers: @@ -74,4 +75,5 @@ Total reclaimed space: 13.5 MB * [system df](system_df.md) * [container prune](container_prune.md) * [image prune](image_prune.md) +* [network prune](network_prune.md) * [system prune](system_prune.md) diff --git a/docs/reference/commandline/volume_prune.md b/docs/reference/commandline/volume_prune.md index 80156296b2..e6866bf244 100644 --- a/docs/reference/commandline/volume_prune.md +++ b/docs/reference/commandline/volume_prune.md @@ -50,4 +50,5 @@ Total reclaimed space: 36 B * [system df](system_df.md) * [container prune](container_prune.md) * [image prune](image_prune.md) +* [network prune](network_prune.md) * [system prune](system_prune.md)