From d1728ad6019fb46186f152586ae526e1ee74e0c5 Mon Sep 17 00:00:00 2001 From: fechin Date: Mon, 9 Jan 2023 11:22:48 +0800 Subject: [PATCH] Added `Clean Up` to docker --- source/_posts/docker.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/_posts/docker.md b/source/_posts/docker.md index fdbdce2..d0a7415 100644 --- a/source/_posts/docker.md +++ b/source/_posts/docker.md @@ -227,17 +227,18 @@ Clean Up {.cols-2} ### Clean All +Cleans up dangling images, containers, volumes, and networks (ie, not associated with a container) ```shell docker system prune ``` -Cleans up dangling images, containers, volumes, and networks (ie, not associated with a container) ------- +Additionally, remove any stopped containers and all unused images (not just dangling images) + ```shell docker system prune -a ``` -Additionally, remove any stopped containers and all unused images (not just dangling images) @@ -255,10 +256,15 @@ docker container prune ### Images +Remove all dangling (not tagged and is not associated with a container) images: ```shell -docker image prune [-a] +docker image prune +``` + +Remove all images which are not used by existing containers +```shell +docker image prune -a ``` -Delete all the images ### Volumes @@ -266,8 +272,7 @@ Delete all the images ```shell docker volume prune ``` -Delete all the volumes - +Remove all volumes not used by at least one container