1、准备Github帐号
自行注册:https://github.com/
2、打开阿里云-容器镜像服务
https://cr.console.aliyun.com/cn-hangzhou/instances
3、绑定Github帐号
4、GitHub仓库准备
4.1.、创建一个项目
4.2、项目创建一个Dockerfile
4.3、往Dockerfile写入指令
FROM registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.7.0 MAINTAINER Q
5、阿里云创建镜像仓库
记得把海外机器构建打勾
6、进入仓库构建项目里面的Dockerfile文件
7、点击立即构建
8、本地拉取镜像
8.1、登陆
~]# docker login --username=*****@qq.com 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
8.2、拉取镜像
~]# docker pull registry.cn-hangzhou.aliyuncs.com/cyc-image/k8s:v0.0.1 v0.0.1: Pulling from cyc-image/k8s 8fdb1fc20e24: Pull complete 4a292fb0d3f2: Pull complete Digest: sha256:8476e83f9c01964e2dbc0247dd4c1904126e84c0e6c4234d86c2d2bfcbf1e9c9 Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/cyc-image/k8s:v0.0.1 registry.cn-hangzhou.aliyuncs.com/cyc-image/k8s:v0.0.1
8.3、上传镜像
# 重新打标签,再上传
~]# docker tag registry.cn-hangzhou.aliyuncs.com/cyc-image/k8s:v0.0.1 registry.cn-hangzhou.aliyuncs.com/cyc-image/k8s:v1.0 ~]# docker push registry.cn-hangzhou.aliyuncs.com/cyc-image/k8s:v1.0 The push refers to repository [registry.cn-hangzhou.aliyuncs.com/cyc-image/k8s] b542f48c9a5b: Layer already exists 9fce6bd02a21: Layer already exists v1.0: digest: sha256:f4c504ea1581b263564c3f02297492a6fd36bde0addafc9a68be7ed3ff736041 size: 739
标签:教程,cn,image,hangzhou,registry,镜像,Docker,k8s,com From: https://www.cnblogs.com/ygbh/p/17318053.html