Ubuntu16.04Docker获取和推送镜像

查找镜像

Docker Hub

http://registry.hub.docker.com

docker search [OPTIONS] TERM

--automated=false 自动化选项,只会显示自动化构件的镜像 
--no-trnc=false 不以截断的方式显示
-s --stars=0 通过星级过滤

eggyer@ubuntu:/usr/local$ docker search ubuntu
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                            Ubuntu is a Debian-based Linux operating s...   5099      [OK]       
ubuntu-upstart                    Upstart is an event-based replacement for ...   69        [OK]       
rastasheep/ubuntu-sshd            Dockerized SSH service, built on top of of...   53                   [OK]
ubuntu-debootstrap                debootstrap --variant=minbase --components...   27        [OK]       
torusware/speedus-ubuntu          Always updated official Ubuntu docker imag...   27                   [OK]
ioft/armhf-ubuntu                 [ABR] Ubuntu Docker images for the ARMv7(a...   19                   [OK]
nuagebec/ubuntu                   Simple always updated Ubuntu docker images...   11                   [OK]
nickistre/ubuntu-lamp             LAMP server on Ubuntu                           11                   [OK]
nickistre/ubuntu-lamp-wordpress   LAMP on Ubuntu with wp-cli installed            7                    [OK]
nimmis/ubuntu                     This is a docker images different LTS vers...   5                    [OK]
maxexcloo/ubuntu                  Base image built on Ubuntu with init, Supe...   2                    [OK]
jordi/ubuntu                      Ubuntu Base Image                               1                    [OK]
admiringworm/ubuntu               Base ubuntu images based on the official u...   1                    [OK]
darksheer/ubuntu                  Base Ubuntu Image -- Updated hourly             1                    [OK]
vcatechnology/ubuntu              A Ubuntu image that is updated daily            0                    [OK]
widerplan/ubuntu                  Our basic Ubuntu images.                        0                    [OK]
esycat/ubuntu                     Ubuntu LTS                                      0                    [OK]
ustclug/ubuntu                    ubuntu image for docker with USTC mirror        0                    [OK]
uvatbc/ubuntu                     Ubuntu images with unprivileged user            0                    [OK]
datenbetrieb/ubuntu               custom flavor of the official ubuntu base ...   0                    [OK]
webhippie/ubuntu                  Docker images for ubuntu                        0                    [OK]
labengine/ubuntu                  Images base ubuntu                              0                    [OK]
konstruktoid/ubuntu               Ubuntu base image                               0                    [OK]
lynxtp/ubuntu                     https://github.com/lynxtp/docker-ubuntu         0                    [OK]
teamrock/ubuntu                   TeamRock's Ubuntu image configured with AW...   0                    [OK]

拉取镜像

docker pull [OPTION] NAME[:TAG]
-a --all-tags=false 下载仓库中所有标记的镜像

eggyer@ubuntu:/usr/local$ docker pull ubuntu:14.04
14.04: Pulling from library/ubuntu
07235cd0e105: Downloading [=====>                                             ] 7.024 MB/65.7 MB
751bed4a496a: Download complete 
1b389da167c9: Download complete 
cd4d9b716097: Download complete 
2bb47aeaf95f: Download complete 
d267439203ef: Download complete 

使用–registry-mirror选项

从前面的测试中可以发现,从docker官网拉取镜像过程很慢

  1. 修改/etc/default/docker
  2. DOCKER_OPTS=”–registry-mirror=http://MIRROR-ADDR

详情见:https://www.daocloud.io

推送镜像

注意要把推送镜像名改为 用户名/xxx的形式不然会出现You cannot push a “root” repository. Please rename your repository to / (ex: eggyer/ubuntu16.04)

docker push name[:TAG]
eggyer@ubuntu:/usr/local$ docker login
Username: eggyer
Password: 
Email: 812022339@qq.com
WARNING: login credentials saved in /home/eggyer/.docker/config.json
Login Succeeded


eggyer@ubuntu:/usr/local$ docker tag bea8f41ae3e8 eggyer/ubuntu16.04
eggyer@ubuntu:/usr/local$ docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu               latest              bea8f41ae3e8        9 days ago          128.1 MB
ubuntu16.04          latest              bea8f41ae3e8        9 days ago          128.1 MB
eggyer/ubuntu16.04   latest              bea8f41ae3e8        9 days ago          128.1 MB
eggyer@ubuntu:/usr/local$ docker push eggyer/ubuntu16.04
The push refers to a repository [docker.io/eggyer/ubuntu16.04] (len: 1)
bea8f41ae3e8: Pushed 
0d2ba69dbe3e: Pushed 
67de889be945: Pushed 
2f5519d4ff74: Pushed 
ed6ff6865688: Pushed 
594949f005fe: Pushing [===================================>               ] 90.85 MB/128.1 MB

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐