Docker 资源管理之build cache 清理

Docker 资源管理之 build cache 清理 [一]

1、Buid cache 简介

平常我们会在docker 构建环境下不断地构建新的镜像,但是当我们不断地构建新的镜像的时候总是获取不到我们需要的镜像,为什么会这个样子呢?其实,是由于image cache 导致的,本身cache 是为了提升build 速度,其会利用现有的cache 来快速构建新的image,因此,当我们构建 image 有问题可以尝试清理下本地的cache;

2、清理本地cache

# docker system prune --volumes
WARNING! This will remove:
  - all stopped containers  # 释放所有stop 的容器
  - all networks not used by at least one container
  - all volumes not used by at least one container
  - all dangling images # 所有虚悬镜像(dangling image)
  - all dangling build cache # 虚悬镜像(dangling image)缓存

Are you sure you want to continue? [y/N]



# docker system prune --all  清除所有缓存
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N]




  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值