Docker将本地镜像发布到阿里云容器镜像服务仓库
阿里云配置
访问 :
https://home.console.aliyun.com/
找到产品与服务项中的容器镜像服务
进入个人实例
创建名称空间
选择创建的名称空间后创建仓库。
指定代码源
发布到阿里云容器镜像服务仓库
查看本地镜像,以
warehouse
为例,将其发布到阿里云容器镜像服务仓库
[root@administrator ~]# docker images | grep warehouse
warehouse 5.7 c20987f18b13 5 months ago 448MB
登录
登录阿里云Docker Registry
docker login --username=5500*****@qq.com registry.cn-chengdu.aliyuncs.com
出现异常:
Error response from daemon: Get "https://registry.cn-chengdu.aliyuncs.com/v2/": unauthorized: authentication required
镜像服务的密码和阿里云账户的密码不是同一个密码,需单独配置。
尝试重新登录
[root@administrator ~]# docker login --username=5500*****@qq.com registry.cn-chengdu.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@administrator ~]#
重命名镜像
使用”docker tag”命令重命名镜像,执行:
docker tag [ImageId] registry.cn-chengdu.aliyuncs.com/cj-warehouse/warehouse:[镜像版本号]
docker tag c20987f18b13 registry.cn-chengdu.aliyuncs.com/cj-warehouse/warehouse:5.7
将镜像推送到Registry
将镜像推送到Registry:执行:docker push registry.cn-chengdu.aliyuncs.com/cj-warehouse/warehouse:[镜像版本号]
[root@administrator ~]# docker push registry.cn-chengdu.aliyuncs.com/cj-warehouse/warehouse:5.7
The push refers to repository [registry.cn-chengdu.aliyuncs.com/cj-warehouse/warehouse]
e889c671872c: Pushed
789f3aa31b3f: Pushed
35ba198e64f5: Pushing [============> ] 78.36MB/313MB
9b64bb048d04: Pushed
aad27784b762: Pushed
0d17fee8db40: Pushed
d7a777f6c3a4: Pushed
a0c2a050fee2: Pushed
0798f2528e83: Pushed
fba7b131c5c3: Pushed
ad6b69b54919: Pushing [=================================> ] 46.08MB/69.27MB
测试
从阿里云Registry中拉取镜像,执行命令:docker pull registry.cn-chengdu.aliyuncs.com/cj-warehouse/warehouse:[镜像版本号]
docker pull registry.cn-chengdu.aliyuncs.com/cj-warehouse/warehouse:5.7
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/136944.html