服务器 
首页 > 服务器 > 浏览文章

Docker镜像上传到阿里云的步骤详解

(编辑:jimmy 日期: 2024/9/22 浏览:3 次 )

1 安装Docker运行环境

参考文档:https://docs.docker.com或者https://www.jb51.net/article/94198.htm

2 注册阿里云账户

阿里云官方网站链接:https://dev.aliyun.com/search.html

例如:

账户:msjtest

密码:123456

3 登陆账户

4 管理Docker Hub镜像站点:配置Docker加速器

链接:https://cr.console.aliyun.com/"_blank" href="https://cr.console.aliyun.com/" rel="external nofollow" >https://cr.console.aliyun.com/"_blank" href="https://cr.console.aliyun.com/" rel="external nofollow" >https://cr.console.aliyun.com/"htmlcode">

$ sudo dockerlogin --username=msjtest registry.cn-hangzhou.aliyuncs.com

注:登录registry的用户名是您的阿里云账号全名,密码是开通namespace时设置的密码。

2)从registry中拉取镜像:

$ sudo dockerpull registry.cn-hangzhou.aliyuncs.com/msj/image-test:[镜像版本号]

3)将镜像推送到registry:

$ sudo dockerlogin --username=mashujie registry.cn-hangzhou.aliyuncs.com
$ sudo dockertag [ImageId] registry.cn-hangzhou.aliyuncs.com/msj/image-test:[镜像版本号]
$ sudo dockerpush registry.cn-hangzhou.aliyuncs.com/msj/image-test:[镜像版本号]

其中[ImageId],[镜像版本号]请你根据自己的镜像信息进行填写。

8 终端执行脚本代码

#登陆命令
$ docker login --username=mashujieregistry.cn-hangzhou.aliyuncs.com
#查看主机镜像
$ docker images
#复制镜像ID并设置tag (或者tag repository:tag)
$ docker tag 96eecaf1019a registry.cn-hangzhou.aliyuncs.com/msj/image-test:helloimage01
$ docker tag image01:01registry.cn-hangzhou.aliyuncs.com/msj/image-test:helloimage01
#上传镜像到阿里云镜像仓库
$ docker pushregistry.cn-hangzhou.aliyuncs.com/msj/image-test:helloimage01

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

上一篇:Nginx一个IP如何配置多个站点的方法教程
下一篇:Linux集群/分布式环境下session处理的五种策略详解
一句话新闻
Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。