一、本地镜像发布到阿里云
1、阿里云ECS Docker生态如下图示
![](https://img-blog.csdnimg.cn/img_convert/7e5f01c235606de50b51864e53cac71a.png)
二、镜像生成方法
1、基于当前容器创建一个新的镜像,新功能增强
命令
docker commit [OPTIONS] 容器ID [REPOSITORY:[TAG]]
OPTIONS说明:
-a :提交的镜像作者;
-m :提交时的说明文字;
本次案例centos+ubuntu两个,当堂讲解一个,家庭作业一个,请大家务必动手,亲自实操。
![](https://img-blog.csdnimg.cn/img_convert/f3479c55ab4ed6b3da6a0260d63624ae.png)
![](https://img-blog.csdnimg.cn/img_convert/805a3b9d4ce5c5727afb9f86d8bf2c4f.png)
三、将本地镜像推送到阿里云
1、本地镜像素材原型
![](https://img-blog.csdnimg.cn/img_convert/45e4ae95666643742d2599cf8bdb3c6c.png)
![](https://img-blog.csdnimg.cn/img_convert/674be9b5b5f2af7c67b7025c97a05832.png)
2、阿里云开发者平台
![](https://img-blog.csdnimg.cn/img_convert/1e05d4533ffe71ec581ea94454010e85.png)
2.1、创建仓库镜像
2.1.1、选择控制台,进入容器服务
![](https://img-blog.csdnimg.cn/img_convert/3ac53a17746056ebe36c0ad326071b09.png)
2.1.2、选择个人实例
![](https://img-blog.csdnimg.cn/img_convert/4661e95d430d6325b14261a72782a393.png)
2.1.3、命名空间
![](https://img-blog.csdnimg.cn/img_convert/b4e1da874e828db1e24b4b8560f41124.png)
2.1.4、仓库名称
![](https://img-blog.csdnimg.cn/img_convert/537c0cefaa174a022cac783bde6b8546.png)
![](https://img-blog.csdnimg.cn/img_convert/c690a7527cc8f65b8acc0caaf56ddbe0.png)
2.1.5、进入管理界面获得脚本
![](https://img-blog.csdnimg.cn/img_convert/d443fc6061e57693e1bc74162a5240b5.png)
2.2、将镜像推送到阿里云
2.2.1、管理界面脚本
注意:只需要根据红色框命令就可以
![](https://img-blog.csdnimg.cn/img_convert/cbab105da7189d3f01d974d4fe9ec8e3.png)
2.2.2、脚本实例
命令:根据上一步脚本一样
# 这边自行组装命令
docker login --username=aliyun9672273963 registry.cn-shenzhen.aliyuncs.com
docker tag [ImageId] registry.cn-shenzhen.aliyuncs.com/docker_lds/myubuntu:[镜像版本号]
docker push registry.cn-shenzhen.aliyuncs.com/docker_lds/myubuntu:[镜像版本号]
![](https://img-blog.csdnimg.cn/img_convert/366e1cb917ed67ef22c1b8fe4f0cc5f2.png)
![](https://img-blog.csdnimg.cn/img_convert/8aa9f55f0e170a2eff0fe8de3a231146.png)
2.3、将阿里云上的镜像下载到本地
docker pull registry.cn-hangzhou.aliyuncs.com/atguiguwh/myubuntu:[TAG]