毫秒镜像(1ms.run)助手工具 - 一键配置容器镜像加速
1ms-helper 是一个专为 毫秒镜像(1ms.run) 设计的命令行助手工具,旨在帮助开发者快速配置容器镜像加速服务。支持 Docker、Kubernetes(K8s)、K3s 等多种容器运行时的一键配置。
| 仓库名称 | 原始地址 | 加速地址 | 状态 |
|---|---|---|---|
| Docker Hub | docker.io | docker.1ms.run | ✅ |
| GitHub Container Registry | ghcr.io | ghcr.1ms.run | ✅ |
| Google Container Registry | gcr.io | gcr.1ms.run | ✅ |
| NVIDIA Container Registry | nvcr.io | nvcr.1ms.run | ✅ |
| Red Hat Quay | quay.io | quay.1ms.run | ✅ |
| Elastic Docker Registry | docker.elastic.co | elastic.1ms.run | ✅ |
| Microsoft Container Registry | mcr.microsoft.com | mcr.1ms.run | ✅ |
| Kubernetes Container Registry | registry.k8s.io | k8s.1ms.run | ✅ |
Linux/macOS:
curl -sSL https://static.1ms.run/1ms-helper/install.sh | bash
# 或者使用 wget
wget -qO- https://static.1ms.run/1ms-helper/install.sh | bash
Windows PowerShell:
# 以管理员身份运行 PowerShell irm https://static.1ms.run/1ms-helper/install.ps1 | iex # 或者下载后执行 Invoke-WebRequest -Uri https://static.1ms.run/1ms-helper/install.ps1 -OutFile install.ps1 .\install.ps1
Windows Git Bash:
curl -sSL https://static.1ms.run/1ms-helper/install.sh | bash
# Linux/macOS 示例
tar -xzf 1ms-helper_Linux_x86_64.tar.gz
sudo mv 1ms-helper /usr/local/bin/
chmod +x /usr/local/bin/1ms-helper
# 克隆仓库
git clone https://cnb.cool/mliev/1ms.run/1ms-helper
cd 1ms-helper
# 安装依赖
go mod tidy
# 编译
go build -o 1ms-helper main.go
# 运行
./1ms-helper
# 显示帮助信息
1ms-helper --help
# 检查毫秒镜像连接状态
1ms-helper check
# Docker 相关命令
1ms-helper config:docker # 一键配置 Docker(推荐)
1ms-helper config:docker:account # 配置 Docker 账号
1ms-helper config:docker:mirror # 配置 Docker 镜像加速
1ms-helper remove:docker:account # 移除 Docker 账号
1ms-helper remove:docker:mirror # 移除 Docker 镜像配置
# Kubernetes 相关命令
1ms-helper config:k8s # 配置 Kubernetes 集群镜像加速
# K3s 相关命令
1ms-helper config:k3s # 配置 K3s 集群镜像加速
# DNS 检查
1ms-helper dns:check # 检查和修复 Docker DNS 配置
1ms-helper check
检查与毫秒镜像的网络连接状态和配置是否正确。
1ms-helper config:docker
依次执行镜像配置和账号配置,适合首次使用的用户。
1ms-helper config:docker:account
按提示输入您在 毫秒镜像 注册的账号进行设备认证。
1ms-helper config:docker:mirror
根据您的系统环境自动配置 Docker daemon 的镜像加速设置。
sudo 1ms-helper config:k8s
适用场景:
功能特性:
注意事项:
如果您直接使用 Containerd 作为容器运行时(非 Kubernetes 集群),可以根据您的场景选择:
config:k8sconfig:k3ssudo 1ms-helper config:k3s
适用场景:
功能特性:
详细说明请参考:K3S_CONFIGURATION.md
1ms-helper config
交互式配置会自动检测您系统中安装的容器运行时,并提供相应的配置选项。适合不确定使用哪个命令的用户。
config:dockerconfig:k8sconfig:k3sconfig 进行交互式配置1ms-helper/ ├── app/ # 应用核心代码 │ ├── Command/ # 命令实现 │ │ ├── Check.go # 连接检查命令 │ │ ├── Config.go # 一键配置命令 │ │ ├── ConfigAccount.go # 账号配置命令 │ │ ├── ConfigMirror.go # 镜像配置命令 │ │ ├── ConfigMirror/ # 镜像配置实现 │ │ │ ├── Linux.go # Linux系统配置 │ │ │ └── Synology.go # 群晖系统配置 │ │ ├── RemoveAccount.go # 账号移除命令 │ │ └── RemoveMirror/ # 镜像移除命令 │ ├── Dto/ # 数据传输对象 │ ├── Interfaces/ # 接口定义 │ ├── Lib/ # 公共库 │ │ ├── Ask.go # 用户交互 │ │ └── Question/ # 问题类型 │ └── Utils/ # 工具类 ├── cmd/ # 命令行入口 ├── config/ # 配置管理 ├── main.go # 程序入口 ├── go.mod # Go模块定义 ├── go.sum # 依赖校验 └── install.sh # 安装脚本
# 克隆项目
git clone https://cnb.cool/mliev/1ms.run/1ms-helper
cd 1ms-helper
# 安装依赖
go mod tidy
# 运行项目
go run main.go
# 运行测试
go test ./...
# 构建二进制文件
go build -o bin/1ms-helper main.go
# 使用 goreleaser 进行跨平台打包
goreleaser release --snapshot --clean
我们欢迎社区贡献!请遵循以下步骤:
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)感谢所有为本项目做出贡献的开发者和 毫秒镜像 团队提供的优质服务。
如果这个项目对您有帮助,请给我们一个 ⭐ Star!
Made with ❤️ by mliev