zl程序教程

您现在的位置是:首页 >  工具

当前栏目

Docker Image发布

Docker 发布 Image
2023-09-27 14:24:30 时间

Docker Image发布

方法1:导出镜像

 #docker save -o centos-httpd-docker-image.tar centos:httpd

使用加载本地镜像

docker load -i centos-httpd-docker-image.tar 

方法2:发布到外网

a、注册

https://hub.docker.com

b、登录

第一次登录

# sudo docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: jiqing9006
Password: 
Login Succeeded

第二次登录

# sudo docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username (jiqing9006): 
Password: 
Login Succeeded

登出

# docker logout
Removing login credentials for https://index.docker.io/v1/

c、推送

# docker push centos:httpd

DOCKER push失败:denied: requested access to the resource is denied

# docker tag d8d913bfc7cc jiqing9006/centos:httpd
# docker push jiqing9006/centos:httpd
The push refers to repository [docker.io/jiqing9006/centos]
79655226b20c: Pushed 
6572279f7725: Pushed 
a4fc816997be: Pushed 
43e653f84b79: Mounted from library/centos 
httpd: digest: sha256:25cb952fa8cc7ac21bb3c9ca7433e152d8b991abd8cf9053b2ff16611c16dba6 size: 1155

d、拉取

# docker pull jiqing9006/centos:httpd
httpd: Pulling from jiqing9006/centos
469cfcc7a4b3: Already exists 
792b552d4922: Already exists 
810e55abfaad: Already exists 
c8d37461b66a: Already exists 
Digest: sha256:25cb952fa8cc7ac21bb3c9ca7433e152d8b991abd8cf9053b2ff16611c16dba6
Status: Downloaded newer image for jiqing9006/centos:httpd