1.本地镜像发布到阿里云流程
2.镜像的生成方法
常见的方式有2种:
- 前面的DockerFile
- 从容器创建一个新的镜像
docker commit [OPTIONS] 容器ID [REPOSITORY[:TAG]]
OPTIONS说明:
-a :提交的镜像作者;
-m :提交时的说明文字;
[root@localhost ~]# docker commit -a="bruce" -m="my ningx" b6a5fce26fb4 bruceliu/mynginx:1.5
sha256:8c7e4a8ac16f08de524990ea7ef902e7ff311df6818fccfc193c90146339f609
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/redis latest 857c4ab5f029 Less than a second ago 98.2 MB
docker.io/nginx latest e445ab08b2be Less than a second ago 126 MB
docker.io/mongo latest 9c02a5a12c52 Less than a second ago 413 MB
docker.io/mysql 5.6 7b01f1418bd7 Less than a second ago 256 MB
docker.io/mysql latest 2151acc12881 Less than a second ago 445 MB
docker.io/tomcat latest 238e6d7313e3 Less than a second ago 506 MB
bruceliu/mynginx 1.5 8c7e4a8ac16f 8 seconds ago 126 MB
mynginx 1.5 ae3c18483aaa 3 minutes ago 126 MB
mynginx v5 e33348896f98 4 minutes ago 126 MB
brucrliu_tomcat latest caefcd845de4 4 hours ago 669 MB
myip1_centos latest 274c58d0c1e4 4 hours ago 314 MB
myip_centos latest 41868e4e4fee 4 hours ago 314 MB
mycentos 1.3 720d4eb5c5f0 6 hours ago 480 MB
bruceliu/centos9527 latest 071e944a589b 13 hours ago 202 MB
bruceliu/tomcat 7-jre7 a66f9aba334d 18 hours ago 359 MB
docker.io/tomcat 7-jre7 47c156f4d4e3 5 weeks ago 359 MB
docker.io/mysql <none> 7bb2586065cd 2 months ago 477 MB
docker.io/centos 7 9f38484d220f 3 months ago 202 MB
docker.io/centos latest 9f38484d220f 3 months ago 202 MB
3.将本地镜像推送到阿里云
- 登录阿里云开发者平台
https://dev.aliyun.com/search.html
https://cr.console.aliyun.com/cn-hangzhou/mirrors - 创建仓库镜像
- 上传镜像
$ sudo docker login --username=tbh589061821fa0nm@aliyun.com registry.cn-hangzhou.aliyuncs.com
$ sudo docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/bruceliu/myninx:[镜像版本号]
$ sudo docker push registry.cn-hangzhou.aliyuncs.com/bruceliu/myninx:[镜像版本号]