7.Ubuntu16.04Docker獲取和推送映象
阿新 • • 發佈:2019-01-06
Ubuntu16.04Docker獲取和推送映象
查詢映象
Docker Hub
docker search
docker search [OPTIONS] TERM
--automated=false 自動化選項,只會顯示自動化構件的映象
--no-trnc=false 不以截斷的方式顯示
-s --stars=0 通過星級過濾
[email protected]:/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官網拉取映象過程很慢
- 修改/etc/default/docker
- DOCKER_OPTS=”–registry-mirror=http://MIRROR-ADDR”
推送映象
注意要把推送映象名改為 使用者名稱/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