码迷,mamicode.com
首页 > 其他好文 > 详细

Docker镜像的获取和推送

时间:2017-07-19 20:32:48      阅读:312      评论:0      收藏:0      [点我收藏+]

标签:ring   research   付费服务   image   var   --   truncate   linu   refers   

  查找镜像

  查找镜像的方法有主要有两种,一种是在Docker Hub官方网站查找,网址为https://hub.docker.com/

技术分享

  另一种方法是在命令行界面中通过docker serach <image>来查找相关的镜像。

  docker search命令说明:

技术分享
docker search [options] TERM
    --authomated=false    Only show automated builds
    --no-trunc=false    Dont truncate output
    -s,--stars=0    Only displays with at least x stars
    最多返回25个结果
View Code

  docker search ubuntu结果:

技术分享
[root@docker ~]# docker search ubuntu
NAME                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                     Ubuntu is a Debian-based Linux operating s...   6281      [OK]       
rastasheep/ubuntu-sshd     Dockerized SSH service, built on top of of...   91                   [OK]
ubuntu-upstart             Upstart is an event-based replacement for ...   74        [OK]       
neurodebian                NeuroDebian provides neuroscience research...   37        [OK]       
ubuntu-debootstrap         debootstrap --variant=minbase --components...   30        [OK]       
32bit/ubuntu               Ubuntu for i386 (32bit)                         30                   
armhf/ubuntu               Ubuntu is a Debian-based Linux operating s...   27                   
nuagebec/ubuntu            Simple always updated Ubuntu docker images...   22                   [OK]
tutum/ubuntu               Simple Ubuntu docker images with SSH access     18                   
ppc64le/ubuntu             Ubuntu is a Debian-based Linux operating s...   10                   
aarch64/ubuntu             Ubuntu is a Debian-based Linux operating s...   9                    
sameersbn/ubuntu                                                           9                    [OK]
i386/ubuntu                Ubuntu is a Debian-based Linux operating s...   7                    
nimmis/ubuntu              This is a docker images different LTS vers...   7                    [OK]
darksheer/ubuntu           Base Ubuntu Image -- Updated hourly             3                    [OK]
libmesos/ubuntu                                                            3                    
scaleway/ubuntu            Ubuntu image on Scaleway                        2                    
webhippie/ubuntu           Docker images for ubuntu                        1                    [OK]
vcatechnology/ubuntu       A Ubuntu image that is updated daily            1                    [OK]
s390x/ubuntu               Ubuntu is a Debian-based Linux operating s...   1                    
konstruktoid/ubuntu        Ubuntu base image                               0                    [OK]
smartentry/ubuntu          ubuntu with smartentry                          0                    [OK]
ossobv/ubuntu              Custom ubuntu image from scratch (based on...   0                    
defensative/socat-ubuntu                                                   0                    [OK]
pivotaldata/ubuntu         A quick freshening-up of the base Ubuntu d...   0                    
[root@docker ~]# 
View Code

  查找3星以上的ubuntu镜像:

技术分享
[root@docker ~]# docker search -s 3 ubuntu
Flag --stars has been deprecated, use --filter=stars=3 instead
NAME                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                   Ubuntu is a Debian-based Linux operating s...   6281      [OK]       
rastasheep/ubuntu-sshd   Dockerized SSH service, built on top of of...   91                   [OK]
ubuntu-upstart           Upstart is an event-based replacement for ...   74        [OK]       
neurodebian              NeuroDebian provides neuroscience research...   37        [OK]       
ubuntu-debootstrap       debootstrap --variant=minbase --components...   30        [OK]       
32bit/ubuntu             Ubuntu for i386 (32bit)                         30                   
armhf/ubuntu             Ubuntu is a Debian-based Linux operating s...   27                   
nuagebec/ubuntu          Simple always updated Ubuntu docker images...   22                   [OK]
tutum/ubuntu             Simple Ubuntu docker images with SSH access     18                   
ppc64le/ubuntu           Ubuntu is a Debian-based Linux operating s...   10                   
aarch64/ubuntu           Ubuntu is a Debian-based Linux operating s...   9                    
sameersbn/ubuntu                                                         9                    [OK]
i386/ubuntu              Ubuntu is a Debian-based Linux operating s...   7                    
nimmis/ubuntu            This is a docker images different LTS vers...   7                    [OK]
darksheer/ubuntu         Base Ubuntu Image -- Updated hourly             3                    [OK]
libmesos/ubuntu                                                          3                    
[root@docker ~]# 
View Code

  拉取镜像

  镜像通过"docker pull <image>"拉取。

  docker pull命令简单说明:

技术分享
docker pull [options] NAME[:TAG]
    -a,--all-tags=false    Download all tagged images in the repository
View Code

  拉取ubuntu:14.04镜像:

技术分享
[root@CentOS7 ~]# docker pull ubuntu:14.04
14.04: Pulling from library/ubuntu
cb56c90f0b30: Pull complete 
0acc551e5716: Pull complete 
8956dcd35143: Pull complete 
908242721214: Pull complete 
b44ff14dd3bb: Pull complete 
Digest: sha256:5faf6cb681da2be979a177b60d8c18497f962e3d82268c49db6c74008d0c294d
Status: Downloaded newer image for ubuntu:14.04
[root@CentOS7 ~]#
View Code

  拉取成功后可以通过docker images查看本地镜像:

技术分享
[root@CentOS7 ~]# docker images
REPOSITORY                              TAG                 IMAGE ID            CREATED             SIZE
jie/df_test1                            latest              cd7c340503bc        3 hours ago         214MB
centos/nginx                            latest              e5faa74eeb5d        5 hours ago         401MB
php                                     latest              2dbd5ab1d9f5        4 days ago          370MB
nginx                                   latest              e4e6d42c70b3        5 days ago          107MB
centos                                  latest              36540f359ca3        11 days ago         193MB
registry                                latest              c2a449c9f834        2 weeks ago         33.2MB
mysql                                   latest              44a8e1a5c0b2        3 weeks ago         407MB
ubuntu                                  latest              d355ed3537e9        3 weeks ago         119MB
ubuntu                                  14.04               4a2820e686c4        3 weeks ago         188MB
daocloud.io/daocloud/daocloud-toolset   latest              bbdc71e950ea        4 months ago        147MB
[root@CentOS7 ~]#
View Code

  由于国内的特殊原因,镜像拉取特别慢,很容易下载失败。所以我们可以使用加速器来加速下载,提高下载成功率,现有的比如网易蜂巢加速器、阿里云加速器和daocloud加速器等。可以根据自己喜好选用。

  推送镜像(需要拥有Docker Hub的账号)

  我们自己构建镜像之后可以通过docker push <image>将自己的镜像推送至Docker Hub仓库中,前提是需要有自己的Docker Hub账号。免费的账号只能有一个存储空间,当然Docker Hub支持付费服务,增加可用空间。

技术分享
[root@docker ~]# docker push jie/df_test1
The push refers to a repository [docker.io/jie/df_test1]
sending image list

please login prior to push:
Username:staryjie
Password:
Email:fngje0128@163.com
Login Successed
The push refers to a repository [docker.io/jie/df_test1]
f5456bfd299d: Pushing 
8f2ab3b3ad55: Waiting 
0566c118947e: Preparing 
6f9cf951edf5: Waiting 
182d2a55830d: Preparing 
5a4c2c9a24fc: Preparing 
cb11ba605400: Waiting
View Code

  等待push完成,上传完成之后即可在Docker Hub中自己的仓库中看到,也可以通过网页搜索查看,如果不想公开,也可以设置镜像为个人,这样别人就无法查看到你的镜像了。

Docker镜像的获取和推送

标签:ring   research   付费服务   image   var   --   truncate   linu   refers   

原文地址:http://www.cnblogs.com/jie-fang/p/7207549.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!