Akiraka Akiraka
  • Home
  • Linux
    • ELK
    • PHP
    • Shell
    • Nginx
    • Docker
      • Docker Compose
    • Centos
    • Ubuntu
    • Jenkins
  • Python
  • Mac OS
  • Windows
  • Big Data
    • Hadoop
    • CDH
    • Hive
    • Spark
    • ZooKeeper
  • K8S
    • Kubernetes
    • Helm
  • Other
  • Quark
  • Contribute
  • Home
  • Linux
    • ELK
    • PHP
    • Shell
    • Nginx
    • Docker
      • Docker Compose
    • Centos
    • Ubuntu
    • Jenkins
  • Python
  • Mac OS
  • Windows
  • Big Data
    • Hadoop
    • CDH
    • Hive
    • Spark
    • ZooKeeper
  • K8S
    • Kubernetes
    • Helm
  • Other
  • Quark
  • Contribute
首页 Linux Docker Kubernetes(k8s) 清理删除未被使用的镜像

Kubernetes(k8s) 清理删除未被使用的镜像

Akiraka 2年前

文章目录

  • 描述
    • 选项
    • Ubuntu 系统添加定时任务
    • Centos 系统添加定时任务

描述

cicd 持久化部署节点越来越多的镜像,磁盘空间越来越不够,这时需要做一个定时清理没有使用的镜像。

选项

参数 描述
--all , -a Remove all unused images, not just dangling ones -----删除所有未使用的映像,而不仅仅是悬空映像
--filter Provide filter values (e.g. ‘until=') -----提供过滤值(例如'until =“)
--force , -f Do not prompt for confirmation -----不要提示确认
until 仅删除在给定时间戳之前创建的映像

Ubuntu 系统添加定时任务

  • 清理10天前创建且当前无容器实例使用的镜像
cat >> /var/spool/cron/crontabs/root << EOF
# 每周一清理无效镜像
* * * * 1 /usr/bin/docker image prune -a --force --filter "until=240h" 2>&1
EOF

Centos 系统添加定时任务

  • 清理10天前创建且当前无容器实例使用的镜像
cat >> /var/spool/cron/root << EOF
# 每周一清理无效镜像
* * * * 1 /usr/bin/docker image prune -a --force --filter "until=240h" 2>&1
EOF
#docker#k8s#kubernetes
4
猜你喜欢
  • Dockerfile 构建 FreeRadis 镜像
  • KeyCloak Docker Compose 部署
  • 密码保护:KeyCloak 结合 Gitlab SSO 一键登录认证
  • 生成 GitLab EE 许可证
  • GitLab 10.4.0 迁移到 Docker 版本 GitLab 14.4.1
Akiraka
站长
本人擅长 Ai、Au、Fl、Ae、Pr、Ps 等软件的安装与卸载,精通 CSS、JavaScript、PHP、Python、Shell、Go 等单词的拼写,熟悉 Windows、Linux、Mac、Android、IOS 等系统的开关机!
158
文章
24
评论
73
获赞
Popular Articles
TOP1
Kubernetes(k8s)Helm 部署 EFK 集群
2年前
TOP2
Kubernetes(k8s)helm 搭建 prometheus + Grafana 监控
2年前
TOP3
Kubernetes(k8s)Helm 部署 Jenkins 持续化集成部署
2年前
TOP4
Container 命令ctr、crictl 命令使用说明
10月前
TOP5
Elasticsearch X-Pack 插件破解
2年前
Related Articles
GitLab 10.4.0 迁移到 Docker 版本 GitLab 14.4.1
7月前
RabbitMQ 非官方镜像搭建
2年前
KeyCloak Docker Compose 部署
2月前
Kubernetes(k8s)Helm 部署 Redis 集群
2年前
查看容器 IP地址
2年前
Copyright © 2019-2022 Akiraka. 沪18036911号