docker--image的獲取


image有幾種獲取方式:

1、Docker官方提供了一種文件格式:Dockerfile,通過這種格式的文件,我們可以定義一個image,然后通過Dockerfile我們可以構建(build)一個image

 

 

 

2、通過registry拉去image

PS:registry 是docker提出的一個概念,有些像github,我們可以從github上 clone軟件,也可以通過push把軟件推到github上,供其他人使用,在docker里借鑒了這個概念,

我們可以通過registry拉取我們需要的image,也可以push到registry上面。

(1)docker hub 是docker免費提供的registry,我們用docker命令獲取image 默認是docker hub(https://hub.docker.com/),如果是pull 拉取,不需要注冊用戶,如果要push則需要。

在docker hub上面可以search搜索有哪些image

 

 (2)docker提供的image分兩類,一種是docker官方提供的 帶official images,另一種是個人提供的,比如Ubuntu image,有多個版本,通過docker pull ubuntu 則默認下載最新版本image,也可以通過tags,加上版本

 

 

(3)除了docker官方提供的image,還有第三方提供的image,通過pull獲取時,需加上用戶名比如

docker pull scrapybook/dev

 

 

 

取ubuntu14.04

[root@localhost ~]# doucker pull ubuntu:14.04
bash: doucker: command not found...
Similar command is: 'docker'
[root@localhost ~]# docker pull ubuntu:14.04
14.04: Pulling from library/ubuntu
a7344f52cb74: Pull complete 
515c9bb51536: Pull complete 
e1eabe0537eb: Pull complete 
4701f1215c13: Pull complete 
Digest: sha256:2f7c79927b346e436cc14c92bd4e5bd778c3bd7037f35bc639ac1589a7acfa90
Status: Downloaded newer image for ubuntu:14.04
[root@localhost ~]# docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              14.04               2c5e00d77a67        7 weeks ago         188MB
hello-world         latest              fce289e99eb9        6 months ago        1.84kB
[root@localhost ~]#

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM