Docker專題(九)-本地鏡像發佈到阿里雲

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.將本地鏡像推送到阿里雲

$ sudo docker login --username=[email protected] 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:[鏡像版本號]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章