mirror of
https://github.com/yeasy/docker_practice.git
synced 2025-08-12 17:52:36 +00:00
restruct the chapter to make it more understanding
This commit is contained in:
38
image/pull.md
Normal file
38
image/pull.md
Normal file
@@ -0,0 +1,38 @@
|
||||
## 获取镜像
|
||||
|
||||
可以使用`docker pull`命令来从仓库获取所需要的镜像。
|
||||
|
||||
下面的例子将从Docker Hub仓库下载一个Ubuntu 12.04操作系统的镜像。
|
||||
```
|
||||
$ sudo docker pull ubuntu:12.04
|
||||
Pulling repository ubuntu
|
||||
ab8e2728644c: Pulling dependent layers
|
||||
511136ea3c5a: Download complete
|
||||
5f0ffaa9455e: Download complete
|
||||
a300658979be: Download complete
|
||||
904483ae0c30: Download complete
|
||||
ffdaafd1ca50: Download complete
|
||||
d047ae21eeaf: Download complete
|
||||
```
|
||||
下载过程中,会输出获取镜像的每一层信息。
|
||||
该命令实际上相当于`$ sudo docker pull registry.hub.docker.com/ubuntu:12.04`命令,即从注册服务器`registry.hub.docker.com`中的`ubuntu`仓库来下载标记为`12.04`的镜像。
|
||||
|
||||
有时候官方仓库注册服务器下载较慢,可以从其他仓库下载。
|
||||
从其它仓库下载时需要指定完整的仓库注册服务器地址。例如
|
||||
```
|
||||
$ sudo docker pull www.dockerpool.com:5000/ubuntu:12.04
|
||||
Pulling www.dockerpool.com:5000/ubuntu
|
||||
ab8e2728644c: Pulling dependent layers
|
||||
511136ea3c5a: Download complete
|
||||
5f0ffaa9455e: Download complete
|
||||
a300658979be: Download complete
|
||||
904483ae0c30: Download complete
|
||||
ffdaafd1ca50: Download complete
|
||||
d047ae21eeaf: Download complete
|
||||
```
|
||||
|
||||
完成后,即可随时使用该镜像了,例如创建一个容器,让其中运行bash应用。
|
||||
```
|
||||
$ sudo docker run -t -i ubuntu:12.04 /bin/bash
|
||||
root@fe7fc4bd8fc9:/#
|
||||
```
|
Reference in New Issue
Block a user