一、注册GitHub账户
地址:GitHub: Where the world builds software · GitHub
二、在github中创建仓库
三、在仓库中创建文件夹,并创建dockerfile
注意:输入创建文件ingress-nginx-controller后在输入/,创建一个文件dockerfile
From k8s.gcr.io/ingress-nginx/controller:v1.1.1
四、注册阿里云账号并登录,打开控制台进入到容器镜像服务
五、创建命名空间
六、创建镜像仓库
七、关联刚刚注册的GitHub账号和仓库
注意:需要勾选海外机器构建
八、添加构建规则
上下文目录就是GitHub中创建的文件夹
Dockerfile路径就是文件夹中创建的文件
九、点击立即构建
十、查看日志是否构建成功
十一、测试拉取镜像
[root@ls_rflrhksm ~]# docker login --username=lixin0608 registry.cn-hangzhou.aliyuncs.com
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@k8s-master01 ingress-nginx]# docker pull registry.cn-hangzhou.aliyuncs.com/lixin-c/controller:v1.1.2
v1.1.2: Pulling from lixin-c/controller
a0d0a0d46f8b: Pull complete
3aae86482564: Pull complete
c0d03781abb3: Pull complete
0297e2ef8f7f: Pull complete
866a68ce3c13: Pull complete
1c2a7ca65b54: Pull complete
41fd2de30e46: Pull complete
637f10464e4d: Pull complete
998064a16da4: Pull complete
e63d23220e8c: Pull complete
8128610547fb: Pull complete
ae07a1a7f038: Pull complete
ceb23c4cb607: Pull complete
Digest: sha256:628cc0d4023eaf9bd7de0cab60a6f9aeb447d3aaa2bb78670604baae94879cef
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/lixin-c/controller:v1.1.2
registry.cn-hangzhou.aliyuncs.com/lixin-c/controller:v1.1.2
[root@k8s-master01 ingress-nginx]# docker images | grep controller
registry.cn-hangzhou.aliyuncs.com/lixin-c/controller v1.1.2 7e5c1cecb086 4 months ago 286MB