英文出自:http://docs.docker.com/linux/step_three/


步骤一:定位whalesay镜像

1、打开你的浏览器并浏览Docker Hub

docker ——查找与运行whalesay镜像


Docker Hub包涵的镜像来自于像你一样单个的某人或来自像RedHat,IBM,Google这些组织的官方镜像,以及更多。


2、打开浏览器并搜索

浏览器打开搜索页面

3、在搜索栏中输入whalesay。

docker ——查找与运行whalesay镜像


4、在搜索结果中点击docker/whalesay镜像。

浏览器显示whalesay镜像仓库。

docker ——查找与运行whalesay镜像

步骤二:运行whalesay镜像

1、把鼠标定位到终端窗口的$提示处。

2、键入docker run docker/whalesay cowsay boo这个命令行,并按回车键。

这个命令运行whalesay镜像于容器中。你的终端应该会有如下的显示:

$ docker run docker/whalesay cowsay boo

Unable to find p_w_picpath 'docker/whalesay:latest' locally
latest: Pulling from docker/whalesay
e9e06b06e14c: Pull complete
a82efea989f9: Pull complete37bea4ee0c81: Pull complete07f8e8c5e660: Pull complete676c4a1897e6: Pull complete5b74edbcaa5b: Pull complete1722f41ddcb5: Pull complete99da72cfe067: Pull complete5d5bd9951e26: Pull complete
fb434121fc77: Already exists
Digest: sha256:d6ee73f978a366cf97974115abe9c4099ed59c6f75c23d03c64446bb9cd49163
Status: Downloaded newer p_w_picpath for docker/whalesay:latest
 _____
< boo > -----
    \
     \
      \                    ##        .
              ## ## ##       ==
           ## ## ## ##      ===
       /""""""""""""""""___/ ===
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
       \______ o          __/
        \    \        __/
          \____\______/


The first time you run a software p_w_picpath, the `docker` command looks for iton your local system. If the p_w_picpath isn't there, then `docker` gets it fromthe hub.

3、当还在终端时,键入docker p_w_picpaths命令然后按回车键。

这个命令会列出你本地系统中的所有镜像。你应该会看到docker/whalesay于列表中。

$ docker p_w_picpaths

REPOSITORY           TAG         IMAGE ID            CREATED            VIRTUAL SIZE
docker/whalesay      latest      fb434121fc77        3 hours ago        247 MB
hello-world          latest      91c95931e552        5 weeks ago        910 B

当你运行一个镜像于一个容器中,Docker会下载镜像到你的电脑中。这个本地拷贝会节约你的时间。如果一个镜像在hub上镜像源改变了,Docker仅会下载一次。当然你也能删除镜像。