Docker 深度清除镜像缓存 (overlay2)

Docker 深度清除镜像缓存 (overlay2)

一般情况下,运维清理镜像是通过命令 docker rm i 删除镜像的。但是这条命令不会删除docker build命令产生的缓存文件。

这个时候需要使用 docker system 的系列命令来做相关处理。

shell 复制代码
docker system --help

输出:

复制代码
# 输出
Usage:  docker system COMMAND

Manage Docker

Commands:
  df          Show docker disk usage
  events      Get real time events from the server
  info        Display system-wide information
  prune       Remove unused data

Run 'docker system COMMAND --help' for more information on a command.

查看缓存情况

shell 复制代码
docker system df 

使用命令 prune 将其彻底清理

shell 复制代码
docker system prune -a --force

参数:

-a 删除全部未使用的镜像

-f--force 不经过确认强行删除。

原文链接

Docker 深度清除镜像缓存 (overlay2)

相关推荐
lichenyang4535 小时前
Docker 学习笔记(五):Docker Compose,用一个 YAML 启动前端、后端和 MongoDB
docker
lichenyang4535 小时前
Docker 学习笔记(四):Dockerfile,把项目打成自己的镜像
docker·容器
lichenyang4535 小时前
Docker 学习笔记(三):Docker 网络、bridge、子网和容器互通
docker·容器
lichenyang4536 小时前
Docker 学习笔记(二):docker run 的参数到底在控制什么?
docker·容器
Patrick_Wilson5 天前
从「改个端口」到 502:Next.js on k8s 的容器端口、Service 映射与 env 覆盖
docker·kubernetes·next.js
Suroy5 天前
DockerView-Go:用 Go 写一个终端 Docker 监控工具,顺便做了个 Web 仪表盘
docker
云恒要逆袭5 天前
运行你的第一个Docker容器
后端·docker·容器
小七-七牛开发者6 天前
TokenPilot:让 LLM Agent 长会话成本降 60%+ 的上下文管理
缓存·agent·token·context·上下文·推理成本
宋均浩6 天前
# Docker 镜像瘦身实战:从 1.2G 到 80MB 的五个优化步骤
ci/cd·docker
程序员老赵7 天前
10 分钟部署 OpenCode:Docker 一键安装,浏览器打开就能用 AI 写代码(附完整命令与排错)
docker·容器·ai编程