Skip to content

Latest commit

 

History

History
135 lines (91 loc) · 3.19 KB

README_zh-CN.md

File metadata and controls

135 lines (91 loc) · 3.19 KB

Docker Image Sync

简体中文 | English

配置阿里云镜像服务

登录阿里云镜像服务:https://cr.console.aliyun.com/

开启个人示例, 并从配置中取得需要的环境变量:

  • ALIYUN_REGISTRY_PASSWORD:固定密码,新建个人示例时创建.
  • ALIYUN_NAME_SPACE:命名空间, solisamicus-images.
  • ALIYUN_REGISTRY_USER:用户名, solisamicus.
  • ALIYUN_REGISTRY:仓库地址, registry.cn-wulanchabu.aliyuncs.com.

Fork 项目

Fork 本仓库.

开启Github Actions

Settings -> Secrets and variables -> Actions -> New Repository Secret.

添加在上一步获取的四个环境变量.

ALIYUN_NAME_SPACE

ALIYUN_REGISTRY

ALIYUN_REGISTRY_PASSWORD

ALIYUN_REGISTRY_USER

添加 Docker 镜像

打开文件 images.txt 并添加你想要同步的仓库(使用# 添加注释)

⭐示例:

nginx

在文件成功提交后, Github Actions 将会自动开始构建过程.

查看阿里云容器镜像服务后你会看到同步过来的docker镜像

使用 Docker 镜像

返回阿里云镜像服务并检查镜像状态

你可以将镜像设为公开, 这样不用登录也能拉取此镜像了

在国内服务器上拉取镜像

docker pull ${ALIYUN_REGISTRY}/${ALIYUN_NAME_SPACE}/nginx

示例:

docker pull registry.cn-wulanchabu.aliyuncs.com/solisamicus-images/nginx
$ docker pull registry.cn-wulanchabu.aliyuncs.com/solisamicus-images/nginx
Using default tag: latest
latest: Pulling from solisamicus-images/nginx
2cc3ae149d28: Pull complete 
a97f9034bc9b: Pull complete 
9571e65a55a3: Pull complete 
0b432cb2d95e: Pull complete 
24436676f2de: Pull complete 
928cc9acedf0: Pull complete 
ca6fb48c6db4: Pull complete 
Digest: sha256:80550935209dd7f6b2d7e8401b9365837e3edd4b047f5a1a7d393e9f04d34498
Status: Downloaded newer image for registry.cn-wulanchabu.aliyuncs.com/solisamicus-images/nginx:latest
registry.cn-wulanchabu.aliyuncs.com/solisamicus-images/nginx:latest

Multi-Architecture

--platform=linux/amd64 nginx:1.25.3

这会导致镜像名含有架构前缀:

registry.cn-wulanchabu.aliyuncs.com/solisamicus-images/linux_amd64_nginx:1.25.3

Duplicate Image Names

namespace1/nginx:1.25.3
namespace2/nginx:1.25.3

这会导致镜像名前缀为命名空间以避免冲突:

registry.cn-wulanchabu.aliyuncs.com/solisamicus/namespace1_nginx:1.25.3
registry.cn-wulanchabu.aliyuncs.com/solisamicus/namespace2_nginx:1.25.3