上传 docker 镜像到阿里云仓库
一、创建镜像仓库
1.1 登入阿里云地址
登入地址:https://aliyun.com
1.2 搜索 “容器镜像服务”,点击管理控制台,找到镜像仓库,创建镜像仓库
二、查看创建镜像仓库
进入仓库查看创建后的镜像仓库信息
三、上传本地镜像到阿里私有仓库
3.1 登入仓库地址
[root@k8s-master ingress]# docker login --username=你的用户名 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
3.2 上传镜像
# 打标签 [root@k8s-master ingress]# docker tag k8s.gcr.io/defaultbackend-amd64:1.5 registry.cn-hangzhou.aliyuncs.com/wangzy001/k8s:1.5 # 上传镜像 [root@k8s-master ingress]# docker push registry.cn-hangzhou.aliyuncs.com/wangzy001/k8s:1.5 The push refers to repository [registry.cn-hangzhou.aliyuncs.com/wangzy001/k8s] b108d4968233: Pushed 1.5: digest: sha256:4dc5e07c8ca4e23bddb3153737d7b8c556e5fb2f29c4558b7cd6e6df99c512c7 size: 528 [root@k8s-master ingress]#
四、查看镜像是否创建成功
登入阿里云查看镜像是否上传成功
五、拉取阿里私有镜像
注:除公网镜像,若拉取私有镜像时需要先登入私有账号,否则无法拉取。
[root@k8s-master ingress]# docker login --username=你的用户名 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-master ingress]# docker pull registry.cn-hangzhou.aliyuncs.com/wangzy001/k8s:1.5 1.5: Pulling from wangzy001/k8s Digest: sha256:4dc5e07c8ca4e23bddb3153737d7b8c556e5fb2f29c4558b7cd6e6df99c512c7 Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/wangzy001/k8s:1.5 registry.cn-hangzhou.aliyuncs.com/wangzy001/k8s:1.5 [root@k8s-master ingress]#
完成