专属域名
文档搜索
轩辕助手
Run助手
邀请有礼
返回顶部
快速返回页面顶部
收起
收起工具栏
轩辕镜像 官方专业版
轩辕镜像 官方专业版轩辕镜像 官方专业版官方专业版
首页个人中心搜索镜像

交易
充值流量我的订单
工具
提交工单镜像收录一键安装
Npm 源Pip 源Homebrew 源
帮助
常见问题
其他
关于我们网站地图

官方QQ群: 1072982923

clockworksoul/docker-gc-cron Docker 镜像 - 轩辕镜像

docker-gc-cron
clockworksoul/docker-gc-cron
自动构建
Allows scheduled execution of Spotify's docker-gc script to clean up unused containers and images.
48 收藏0 次下载
😅 镜像要是出问题,背锅的一定是你
镜像简介版本下载
😅 镜像要是出问题,背锅的一定是你

docker-gc-cron

The docker-gc-cron container will periodically run the very excellent Spotify docker-gc script script to automatically clean up unused containers and images. It's particularly useful when deployed on systems onto which large numbers of Docker images and containers are built or pulled, such as CI nodes.

By default, the process will run each night at midnight, but the timing and other behaviors can be precisely specified using standard cron syntax. A docker-compose.yml file for this purpose can be found in the compose directory of this repository to simplify execution.

Installation tl;dr

$ wget [***]
$ wget [***]
$ docker-compose up -d

This will pull and execute a docker-gc-cron image associated with your installed Docker daemon. By default, the garbage collection process will execute nightly at midnight, but this can be easily changed by modifying the CRON property (see below).

Yes, the docker-gc-exclude is necessary when using this docker-compose.yml file.

Supported Environmental Settings

The container understands all of the settings that are supported by docker-gc, as well as additional settings that can be used to modify the cleanup frequency.

Much of the following documentation is borrowed and modified directly from the docker-gc README.

All of the following environmental variables can also be used by getting and modifying the docker-compose.yml file.

Modifying the cleanup schedule

By default, the docker-gc-cron process will run nightly at midnight (cron "0 0 * * *"). This schedule can be overridden by using the CRON setting as follows:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e CRON="0 */6 * * *" clockworksoul/docker-gc-cron
Forcing deletion of images that have multiple tags

By default, docker will not remove an image if it is tagged in multiple repositories. If you have a server running Docker where this is the case, for example in CI environments where dockers are being built, re-tagged, and pushed, you can enable a force flag to override this default.

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e FORCE_IMAGE_REMOVAL=1 clockworksoul/docker-gc-cron
Preserving a minimum number of images for every repository

You might want to always keep a set of the most recent images for any repository. For example, if you are continually rebuilding an image during development you would want to clear out all but the most recent version of an image. To do so, set the MINIMUM_IMAGES_TO_SAVE=1 environment variable. You can preserve any count of the most recent images, e.g. save the most recent 10 with MINIMUM_IMAGES_TO_SAVE=10.

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e MINIMUM_IMAGES_TO_SAVE=3 clockworksoul/docker-gc-cron
Forcing deletion of containers

By default, if an error is encountered when cleaning up a container, Docker will report the error back and leave it on disk. This can sometimes lead to containers accumulating. If you run into this issue, you can force the removal of the container by setting the environment variable below:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e FORCE_CONTAINER_REMOVAL=1 clockworksoul/docker-gc-cron
Excluding Recently Exited Containers and Images From Garbage Collection

By default, docker-gc will not remove a container if it exited less than 3600 seconds (1 hour) ago. In some cases you might need to change this setting (e.g. you need exited containers to stick around for debugging for several days). Set the GRACE_PERIOD_SECONDS variable to override this default.

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e GRACE_PERIOD_SECONDS=86400 clockworksoul/docker-gc-cron

This setting also prevents the removal of images that have been created less than GRACE_PERIOD_SECONDS seconds ago.

Cleaning up orphaned container volumes

Orphaned volumes that were created by containers that no longer exist can, over time, grow to take up a significant amount of disk space. By default, this process will leave any orphaned volumes untouched. However, to instruct the process to automatically clean up any dangling volumes using a docker volume rm $(docker volume ls -qf dangling=true) call after the docker-gc process has been executed, simply set the CLEAN_UP_VOLUMES value to 1.

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e CLEAN_UP_VOLUMES=1 clockworksoul/docker-gc-cron
Dry run

By default, docker-gc will proceed with deletion of containers and images. To test your command-line options set the DRY_RUN variable to override this default.

docker run -d -v /var/run/docker.sock:/var/run/docker.sock -e DRY_RUN=1 clockworksoul/docker-gc-cron
查看更多 docker-gc-cron 相关镜像 →
airbyte/cron logo
airbyte/cron
暂无描述
210M+ pulls
上次更新:未知
docker/dockerfile logo
docker/dockerfile
这些是官方提供的Dockerfile前端镜像,主要功能是支持通过BuildKit构建Dockerfile,作为构建流程中的关键前端工具,能够有效配合BuildKit提升Dockerfile的构建效率、安全性与灵活性,为开发者提供官方认可的标准化构建方案,适用于各类基于Docker的应用开发与部署场景,确保构建过程的稳定可靠及操作便捷性。
124500M+ pulls
上次更新:未知
docker/dockerfile-copy logo
docker/dockerfile-copy
此Docker镜像已被弃用。
150M+ pulls
上次更新:未知
docker/docker-model-backend-llamacpp logo
docker/docker-model-backend-llamacpp
暂无描述
110M+ pulls
上次更新:未知
docker/docker-mcp-cli-desktop-module logo
docker/docker-mcp-cli-desktop-module
暂无描述
5M+ pulls
上次更新:未知
docker/welcome-to-docker logo
docker/welcome-to-docker
供Docker新手入门使用的Docker镜像。
701M+ pulls
上次更新:未知

轩辕镜像配置手册

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式

登录仓库拉取

通过 Docker 登录认证访问私有仓库

Linux

在 Linux 系统配置镜像服务

Windows/Mac

在 Docker Desktop 配置镜像

Docker Compose

Docker Compose 项目配置

K8s Containerd

Kubernetes 集群配置 Containerd

K3s

K3s 轻量级 Kubernetes 镜像加速

Dev Containers

VS Code Dev Containers 配置

MacOS OrbStack

MacOS OrbStack 容器配置

宝塔面板

在宝塔面板一键配置镜像

群晖

Synology 群晖 NAS 配置

飞牛

飞牛 fnOS 系统配置镜像

极空间

极空间 NAS 系统配置服务

爱快路由

爱快 iKuai 路由系统配置

绿联

绿联 NAS 系统配置镜像

威联通

QNAP 威联通 NAS 配置

Podman

Podman 容器引擎配置

Singularity/Apptainer

HPC 科学计算容器配置

其他仓库配置

ghcr、Quay、nvcr 等镜像仓库

专属域名拉取

无需登录使用专属域名

需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单

镜像拉取常见问题

轩辕镜像免费版与专业版有什么区别?

免费版仅支持 Docker Hub 访问,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。

轩辕镜像支持哪些镜像仓库?

专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等;免费版仅支持 docker.io。

流量耗尽错误提示

当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。

410 错误问题

通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。

manifest unknown 错误

先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。

镜像拉取成功后,如何去掉轩辕镜像域名前缀?

使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。

查看全部问题→

用户好评

来自真实用户的反馈,见证轩辕镜像的优质服务

用户头像

oldzhang

运维工程师

Linux服务器

5

"Docker访问体验非常流畅,大镜像也能快速完成下载。"

轩辕镜像
镜像详情
...
clockworksoul/docker-gc-cron
官方博客Docker 镜像使用技巧与技术博客
热门镜像查看热门 Docker 镜像推荐
一键安装一键安装 Docker 并配置镜像源
咨询镜像拉取问题请 提交工单,官方技术交流群:1072982923
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
咨询镜像拉取问题请提交工单,官方技术交流群:
轩辕镜像面向开发者与科研用户,提供开源镜像的搜索和访问支持。所有镜像均来源于原始仓库,本站不存储、不修改、不传播任何镜像内容。
官方邮箱:点击复制邮箱
©2024-2026 源码跳动
官方邮箱:点击复制邮箱Copyright © 2024-2026 杭州源码跳动科技有限公司. All rights reserved.