1. 程式人生 > >Docker(八):本地映象推送到阿里雲

Docker(八):本地映象推送到阿里雲

在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述

裡面有詳細的將映象push到阿里雲倉庫的步驟

啟動容器

[[email protected] /]# docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
zhaoyoungtomcat9         latest              124517434916        20 hours ago        751MB
myip_son                 latest              6c9507aea358        2 days ago          398MB
myip_father              latest              2c22e721607a        2 days ago          299MB
myip2                    latest              dcbb4656e640        2 days ago          299MB
myip                     latest              9e3c14f76b1d        2 days ago          299MB
mycentos                 1.0                 c2d4f6acb9af        3 days ago          455MB
zhaoyoung/nodocstomcat   1.0                 84498728984a        5 days ago          463MB
centos                   latest              75835a67d134        6 days ago          200MB
redis                    3.2                 a17eb18b1c62        13 days ago         76MB
tomcat                   latest              41a54fe1f79d        4 weeks ago         463MB
hello-world              latest              4ab4c602aa5e        5 weeks ago         1.84kB
mysql                    5.6                 1f47fade220d        5 weeks ago         256MB
[
[email protected]
/]# docker run -it c2d4f6acb9af [[email protected] local]# [[email protected] /]# ctrl+P ctrl+Q 退出

提交新的映象

[[email protected] /]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
05cdb5a045b4        c2d4f6acb9af        "/bin/sh -c /bin/bash"   11 seconds ago      Up 8 seconds        80/tcp              optimistic_thompson
[
[email protected]
/]# docker commit -a zhaoyoung -m "new mycentos1.1 with vim and ifconfig" 05cdb5a045b4 mycentos:1.1 sha256:de8fc9f45769b5ae41c25d219a6aacf1b0e698586daff771ada8928875aa44eb [[email protected] /]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mycentos 1.1 de8fc9f45769 5 seconds ago 455MB zhaoyoungtomcat9 latest 124517434916 20 hours ago 751MB myip_son latest 6c9507aea358 2 days ago 398MB myip_father latest 2c22e721607a 2 days ago 299MB myip2 latest dcbb4656e640 2 days ago 299MB myip latest 9e3c14f76b1d 2 days ago 299MB mycentos 1.0 c2d4f6acb9af 3 days ago 455MB zhaoyoung/nodocstomcat 1.0 84498728984a 5 days ago 463MB centos latest 75835a67d134 6 days ago 200MB redis 3.2 a17eb18b1c62 13 days ago 76MB tomcat latest 41a54fe1f79d 4 weeks ago 463MB hello-world latest 4ab4c602aa5e 5 weeks ago 1.84kB mysql 5.6 1f47fade220d 5 weeks ago 256MB

登入阿里雲倉庫

[[email protected] /]# docker login --username=你的登入名 registry.cn-hangzhou.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

推送到倉庫

[[email protected] /]# docker images mycentos
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
mycentos            1.1                 de8fc9f45769        29 minutes ago      455MB
mycentos            1.0                 c2d4f6acb9af        3 days ago          455MB
[[email protected] /]# docker tag de8fc9f45769 registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos:1.1
[[email protected] /]# docker push registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos:1.1
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos]
e1ff317a4989: Pushed 
6ba319aca111: Pushed 
f972d139738d: Pushed 
1.1: digest: sha256:500a30881c883c121307e3c19f7d0be0392ff6a6613a83ef1188574739c12ddc size: 953

[[email protected] /]# docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
mycentos                                               1.1                 de8fc9f45769        40 minutes ago      455MB
registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos   1.1                 de8fc9f45769        40 minutes ago      455MB
zhaoyoungtomcat9                                       latest              124517434916        20 hours ago        751MB
myip_son                                               latest              6c9507aea358        2 days ago          398MB
myip_father                                            latest              2c22e721607a        2 days ago          299MB
myip2                                                  latest              dcbb4656e640        2 days ago          299MB
myip                                                   latest              9e3c14f76b1d        2 days ago          299MB
mycentos                                               1.0                 c2d4f6acb9af        3 days ago          455MB
zhaoyoung/nodocstomcat                                 1.0                 84498728984a        5 days ago          463MB
centos                                                 latest              75835a67d134        6 days ago          200MB
redis                                                  3.2                 a17eb18b1c62        13 days ago         76MB
tomcat                                                 latest              41a54fe1f79d        4 weeks ago         463MB
hello-world                                            latest              4ab4c602aa5e        5 weeks ago         1.84kB
mysql                                                  5.6                 1f47fade220d        5 weeks ago         256MB

在阿里雲倉庫進行搜尋

在這裡插入圖片描述

pull映象

[[email protected] /]# docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
mycentos                                               1.1                 de8fc9f45769        44 minutes ago      455MB
registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos   1.1                 de8fc9f45769        44 minutes ago      455MB
zhaoyoungtomcat9                                       latest              124517434916        20 hours ago        751MB
myip_son                                               latest              6c9507aea358        2 days ago          398MB
myip_father                                            latest              2c22e721607a        2 days ago          299MB
myip2                                                  latest              dcbb4656e640        2 days ago          299MB
myip                                                   latest              9e3c14f76b1d        2 days ago          299MB
mycentos                                               1.0                 c2d4f6acb9af        3 days ago          455MB
zhaoyoung/nodocstomcat                                 1.0                 84498728984a        5 days ago          463MB
centos                                                 latest              75835a67d134        6 days ago          200MB
redis                                                  3.2                 a17eb18b1c62        13 days ago         76MB
tomcat                                                 latest              41a54fe1f79d        4 weeks ago         463MB
hello-world                                            latest              4ab4c602aa5e        5 weeks ago         1.84kB
mysql                                                  5.6                 1f47fade220d        5 weeks ago         256MB
[[email protected] /]# docker rmi -f registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos:1.1
Untagged: registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos:1.1
Untagged: registry.cn-hangzhou.aliyuncs.com/zhaoyoung/[email protected]:500a30881c883c121307e3c19f7d0be0392ff6a6613a83ef1188574739c12ddc
[[email protected] /]# docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
mycentos                 1.1                 de8fc9f45769        44 minutes ago      455MB
zhaoyoungtomcat9         latest              124517434916        20 hours ago        751MB
myip_son                 latest              6c9507aea358        2 days ago          398MB
myip_father              latest              2c22e721607a        2 days ago          299MB
myip2                    latest              dcbb4656e640        2 days ago          299MB
myip                     latest              9e3c14f76b1d        2 days ago          299MB
mycentos                 1.0                 c2d4f6acb9af        3 days ago          455MB
zhaoyoung/nodocstomcat   1.0                 84498728984a        5 days ago          463MB
centos                   latest              75835a67d134        6 days ago          200MB
redis                    3.2                 a17eb18b1c62        13 days ago         76MB
tomcat                   latest              41a54fe1f79d        4 weeks ago         463MB
hello-world              latest              4ab4c602aa5e        5 weeks ago         1.84kB
mysql                    5.6                 1f47fade220d        5 weeks ago         256MB

在這裡插入圖片描述

複製搜尋出來的連結

[[email protected] /]# docker pull registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos:1.1
1.1: Pulling from zhaoyoung/mycentos
Digest: sha256:500a30881c883c121307e3c19f7d0be0392ff6a6613a83ef1188574739c12ddc
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos:1.1
[[email protected] /]# docker images
REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
mycentos                                               1.1                 de8fc9f45769        About an hour ago   455MB
registry.cn-hangzhou.aliyuncs.com/zhaoyoung/mycentos   1.1                 de8fc9f45769        About an hour ago   455MB
zhaoyoungtomcat9                                       latest              124517434916        20 hours ago        751MB
myip_son                                               latest              6c9507aea358        2 days ago          398MB
myip_father                                            latest              2c22e721607a        2 days ago          299MB
myip2                                                  latest              dcbb4656e640        2 days ago          299MB
myip                                                   latest              9e3c14f76b1d        2 days ago          299MB
mycentos                                               1.0                 c2d4f6acb9af        3 days ago          455MB
zhaoyoung/nodocstomcat                                 1.0                 84498728984a        5 days ago          463MB
centos                                                 latest              75835a67d134        6 days ago          200MB
redis                                                  3.2                 a17eb18b1c62        13 days ago         76MB
tomcat                                                 latest              41a54fe1f79d        4 weeks ago         463MB
hello-world                                            latest              4ab4c602aa5e        5 weeks ago         1.84kB
mysql                                                  5.6                 1f47fade220d        5 weeks ago         256MB