docker_practice/image/get.md

22 lines
693 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

##获取images
我们如何获取新的images呢当我们启动容器使用的image不在本地时docker会自动从远端仓库docker hub下载它们这需要消耗一些时间。
因此可以使用docker pull命令来预先下载所需要的image。
下面的例子下载一个centos镜像。
```
$ sudo docker pull centos
Pulling repository centos
b7de3133ff98: Pulling dependent layers
5cc9e91966f7: Pulling fs layer
511136ea3c5a: Download complete
ef52fb1fe610: Download complete
```
下载过程中会输出获取image的每一层信息。
下载完成后,即可随时创建并启动一个容器了。
```
$ sudo docker run -t -i centos /bin/bash
bash-4.1#
```