docker镜像的获取和推送

查找镜像
docker hub
https://registry.hub.docker.com



docker search 
root@eddy:~# docker search --help

Usage:	docker search [OPTIONS] TERM

Search the Docker Hub for images

  --automated=false    Only show automated builds
  --help=false         Print usage
  --no-trunc=false     Don't truncate output
  -s, --stars=0        Only displays with at least x stars
root@eddy:~# docker search ubuntu
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                            Ubuntu is a Debian-based Linux operating s...   3047      [OK]       
ubuntu-upstart                    Upstart is an event-based replacement for ...   60        [OK]       
torusware/speedus-ubuntu          Always updated official Ubuntu docker imag...   25                   [OK]
ubuntu-debootstrap                debootstrap --variant=minbase --components...   24        [OK]       
tleyden5iwx/ubuntu-cuda           Ubuntu 14.04 with CUDA drivers pre-installed    19                   [OK]
rastasheep/ubuntu-sshd            Dockerized SSH service, built on top of of...   18                   [OK]
consol/ubuntu-xfce-vnc            Ubuntu container with "headless" VNC sessi...   8                    [OK]
sameersbn/ubuntu                                                                  5                    [OK]
nuagebec/ubuntu                   Simple always updated Ubuntu docker images...   4                    [OK]
nimmis/ubuntu                     This is a docker images different LTS vers...   3                    [OK]
nickistre/ubuntu-lamp-wordpress   LAMP on Ubuntu with wp-cli installed            3                    [OK]
maxexcloo/ubuntu                  Docker base image built on Ubuntu with Sup...   2                    [OK]
sylvainlasnier/ubuntu             Ubuntu 15.10 root docker images with commo...   2                    [OK]
densuke/ubuntu-jp-remix           Ubuntu Linuxの日本語remix風味です                       2                    [OK]
sassmann/ubuntu-steam              Steam based on Ubuntu                          1                    [OK]
seetheprogress/ubuntu             Ubuntu image provided by seetheprogress us...   1                    [OK]
nickistre/ubuntu-lamp             LAMP server on Ubuntu                           1                    [OK]
isuper/base-ubuntu                This is just a small and clean base Ubuntu...   1                    [OK]
zoni/ubuntu                                                                       0                    [OK]
konstruktoid/ubuntu               Ubuntu base image                               0                    [OK]
birkof/ubuntu                     Ubuntu 14.04 LTS (Trusty Tahr)                  0                    [OK]
teamrock/ubuntu                   TeamRock's Ubuntu image configured with AW...   0                    [OK]
esycat/ubuntu                     Ubuntu LTS                                      0                    [OK]
webhippie/ubuntu                  Docker images for ubuntu                        0                    [OK]
rallias/ubuntu                    Ubuntu with the needful                         0                    [OK]

指定三星以上的
root@eddy:~# docker search -s 3 ubuntu 
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                            Ubuntu is a Debian-based Linux operating s...   3047      [OK]       
ubuntu-upstart                    Upstart is an event-based replacement for ...   60        [OK]       
torusware/speedus-ubuntu          Always updated official Ubuntu docker imag...   25                   [OK]
ubuntu-debootstrap                debootstrap --variant=minbase --components...   24        [OK]       
tleyden5iwx/ubuntu-cuda           Ubuntu 14.04 with CUDA drivers pre-installed    19                   [OK]
rastasheep/ubuntu-sshd            Dockerized SSH service, built on top of of...   18                   [OK]
consol/ubuntu-xfce-vnc            Ubuntu container with "headless" VNC sessi...   8                    [OK]
sameersbn/ubuntu                                                                  5                    [OK]
nuagebec/ubuntu                   Simple always updated Ubuntu docker images...   4                    [OK]
nimmis/ubuntu                     This is a docker images different LTS vers...   3                    [OK]
nickistre/ubuntu-lamp-wordpress   LAMP on Ubuntu with wp-cli installed            3                    [OK]


拉取镜像
root@eddy:~# docker pull -help
Warning: '-help' is deprecated, it will be replaced by '--help' soon. See usage.

Usage:	docker pull [OPTIONS] NAME[:TAG|@DIGEST]

Pull an image or a repository from a registry

  -a, --all-tags=false            Download all tagged images in the repository
  --disable-content-trust=true    Skip image verification
  --help=false                    Print usage
root@eddy:~# docker pull ubuntu:14.04
Pulling repository docker.io/library/ubuntu
Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/ubuntu/images. You may want to check your internet connection or if you are behind a proxy.
由于docker hub在国外,基于国情,需要使用国内的镜像源
修改
使用--registry-mirror
1.修改/etc/default/docker
2. 添加DOCKER_OPTS="--registry-mirror=HTTP://MIRROR-ADDR"
https://www.daocloud.io
--registry-mirror=http://d9768597.m.daocloud.io
root@eddy:~# ps -ef|grep docker
root      3395     1  6 12:30 ?        00:00:00 /usr/bin/docker daemon --registry-mirror=http://d9768597.m.daocloud.io

root@eddy:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos63-bash       latest              9a769720073e        2 days ago          289.6 MB
ubuntu-base         latest              a92d7a8df1bc        2 days ago          172.7 MB

root@eddy:~# docker pull ubuntu:14.04

root@eddy:~# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos63-bash       latest              9a769720073e        2 days ago          289.6 MB
ubuntu-base         latest              a92d7a8df1bc        2 days ago          172.7 MB
ubuntu              14.04               6cc0fc2a5ee3        4 days ago          187.9 MB


推送镜像
docker push
root@eddy:~# docker push --help

Usage:	docker push [OPTIONS] NAME[:TAG]

Push an image or a repository to a registry

  --disable-content-trust=true    Skip image signing
  --help=false                    Print usage

可根据daocloud.io的教程进行推送
root@eddy:~# docker login daocloud.io
Username: xxxx
Password: 
Email: xxxxxx
WARNING: login credentials saved in /root/.docker/config.json
Login Succeeded
........


你可能感兴趣的:(docker镜像的获取和推送)