DockerHub镜像上传下载

前言

镜像是Docker最核心的技术之一,也是应用发布的标准格式。Docker 镜像源与Git中的repo地址有些相似。在Docker的默认配置中,其镜像源主要是来自官方Registry(官方网站专门有一个页面来存储所有可用的镜像,网址是:index.docker.io。我们可以通过浏览这个网页来查找想要使用的镜像,或者使用命令行的工具来检索)

 

1、https://hub.docker.com/  注册账号

 DockerHub镜像上传下载

 

2、本地登录DockerHub

[root@docker01 ~]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you dont have a Docker ID, head over to https://hub.docker.com to create one.
Username: wuxinchun
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

 

 

3、本地镜像打上tag标签

[root@docker01 ~]# docker images 
REPOSITORY                      TAG       IMAGE ID       CREATED         SIZE
busybox                         latest    42b97d3c2ae9   6 days ago      1.24MB
[root@docker01 ~]# docker tag busybox:latest wuxinchun/busybox:latest   //镜像名必须是以DockerHub账号名开头
[root@docker01 ~]# docker images 
REPOSITORY                      TAG       IMAGE ID       CREATED         SIZE
busybox                         latest    42b97d3c2ae9   6 days ago      1.24MB
wuxinchun/busybox               latest    42b97d3c2ae9   6 days ago      1.24MB

 

 

4、本地镜像推送到DockerHub

[root@docker01 ~]# docker push wuxinchun/busybox:latest
The push refers to repository [docker.io/wuxinchun/busybox]
0fd05bf2930d: Pushed 
latest: digest: sha256:b862520da7361ea093806d292ce355188ae83f21e8e3b2a3ce4dbdba0a230f83 size: 527

 

 

5、DockerHub查看push的镜像

DockerHub镜像上传下载

 

6、DockerHub镜像下载

如果镜像属性为public,无需登录DockerHub账号,直接docker pull,反之需要先登录再下载

[root@docker02 ~]# docker pull wuxinchun/busybox:latest
latest: Pulling from wuxinchun/busybox
Digest: sha256:b862520da7361ea093806d292ce355188ae83f21e8e3b2a3ce4dbdba0a230f83
Status: Downloaded newer image for wuxinchun/busybox:latest
docker.io/wuxinchun/busybox:latest
[root@docker02 ~]# docker images 
REPOSITORY                      TAG       IMAGE ID       CREATED         SIZE
wuxinchun/busybox               latest    42b97d3c2ae9   6 days ago      1.24MB

 

DockerHub镜像上传下载

上一篇:tp5.1 微信支付、支付宝、招商支付(Payment)


下一篇:js基本数据类型之间的转换