From 93f36174b046bfdcf113cc9e89a727cc042a5662 Mon Sep 17 00:00:00 2001 From: jiawenlong <1183011789@qq.com> Date: Wed, 27 Mar 2024 10:57:53 +0800 Subject: [PATCH] =?UTF-8?q?docker=E6=B8=85=E7=90=86=E7=A3=81=E7=9B=98?= =?UTF-8?q?=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...72\351\227\264\345\244\252\345\244\247.md" | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git "a/Docker/\345\237\272\347\241\200/23-overlay2\345\215\240\347\224\250\347\251\272\351\227\264\345\244\252\345\244\247.md" "b/Docker/\345\237\272\347\241\200/23-overlay2\345\215\240\347\224\250\347\251\272\351\227\264\345\244\252\345\244\247.md" index 72013fd..7d02354 100644 --- "a/Docker/\345\237\272\347\241\200/23-overlay2\345\215\240\347\224\250\347\251\272\351\227\264\345\244\252\345\244\247.md" +++ "b/Docker/\345\237\272\347\241\200/23-overlay2\345\215\240\347\224\250\347\251\272\351\227\264\345\244\252\345\244\247.md" @@ -15,26 +15,43 @@ docker system df # Build Cache 0 0 0B 0B ``` -### 自动清理空间 +### 清理悬挂的容器(即已停止的容器) -- 已停止的容器(container) -- 未被任何容器所使用的卷(volume) -- 未被任何容器所关联的网络(network) -- 所有悬空镜像(image) -- -a: 清除所有未使用的镜像和悬空镜像 +```shell +docker container prune + +# 不用输入y确认 +# docker container prune -f +``` + +### 清理未使用的镜像(不包括标签为':'的镜像) ```shell -docker system prune -a +docker image prune -a +``` + +### 清理未使用的网络 + +```shell +docker network prune ``` -### 清理未使用的数据卷 +### 清理未使用的卷 ```shell -# 将未被使用的数据卷清理掉 docker volume prune +``` -# 不用输入y确认 -# docker volume prune -f +### 清理所有未被容器使用的镜像、网络和卷 + +```shell +docker system prune +``` + +### 清理所有未被容器使用的镜像、网络、卷、构建缓存 + +```shell +docker system prune -a ``` --- -- Gitee