本地镜像发布到阿里云
-
访问https://cr.console.aliyun.com/cn-hangzhou/instances进入阿里云容器镜像服务界面,这里我用的个人版的,自己测试玩一下的。
-
创建命名空间
-
创建镜像仓库
-
查询镜像仓库详情,下面的步骤需要使用里面的命令
-
在终端里面登录阿里云镜像仓库
docker login --username=你的用户名 registry.cn-hangzhou.aliyuncs.com
这里的–username为你自己的用户名
-
打tag,使镜像带上命名空间以及版本号
docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/luolinyi/docker-demo:[镜像版本号]
ImageId:为你本地镜像的ID
镜像版本号:为新镜像的版本号
-
推送至阿里云
docker push registry.cn-hangzhou.aliyuncs.com/luolinyi/docker-demo:[镜像版本号]
镜像版本号:为你刚指定的新的镜像版本号
因为我之前推送过了,所以之前的镜像层会提示已存在,如果是第一次推送就不会有这个提示哈
- 在阿里云进行查询刚上传的镜像
-
拉取刚上传的镜像
docker pull registry.cn-hangzhou.aliyuncs.com/luolinyi/docker-demo:[镜像版本号]
镜像版本号:阿里云的镜像版本号