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 ~]#

猜你喜欢

转载自www.cnblogs.com/laonicc/p/11142558.html
今日推荐