Find and run the whalesay image from Docker hub

Docker Hub 犹如 Github 一样,存放着丰富的 images。本文讲介绍如何在 Docker Hub 上查找并且运行 whalesay image

查找 whalesay image

  1. 打开 https://hub.docker.com/
  2. 查找 whalesay
  3. 找到 docker/whalesay 这个 image
  4. 打开 image 首页,可以看到 image 的详细信息

让 whalesay 跑起来

  1. 启动 container:eval "$(docker-machine env dev)"
  2. 运行 image:docker run docker/whale cowsay bobo

此时将会输出:

➜  mydockerbuild  docker run docker/whalesay cowsay bo
 ____
< bobo >
 ----
    \
     \
      \
                    ##        .
              ## ## ##       ==
           ## ## ## ##      ===
       /""""""""""""""""___/ ===
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
       \______ o          __/
        \    \        __/
          \____\______/

尝试其它command,你将会发现更有趣的事情:

docker run docker/whalesay cowsay hello, bobo

发生了什么

当执行 docker run docker/whale cowsay boboo 时:

  1. docker 检查本地是否有 docker/whale
  2. 如果没有 docker/whale ,则从 Docker Hub 上下载最新的 image
  3. 运行 docker/whale,并且调用 image 中的 cowsay 程序,并传入 bobo 参数

此时查看本地 images,这里会多一个 docker/whale

➜  mydockerbuild  docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
docker/whalesay          latest              fb434121fc77        4 months ago        247 MB
ubuntu                   latest              91e54dfb1179        6 weeks ago         188.4 MB
hello-world              latest              af340544ed62        8 weeks ago         960 B

参考

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Docker — 云时代的程序分发方式 要说最近一年云计算业界有什么大事件?Google Compute Engi...
    ahohoho阅读 15,695评论 15 147
  • 一、Docker 简介 Docker 两个主要部件:Docker: 开源的容器虚拟化平台Docker Hub: 用...
    R_X阅读 9,836评论 0 27
  • 以下原文转载于(https://docs.docker.com/docker-for-mac/)(想找中文版的最新...
    Veekend阅读 12,230评论 0 17
  • 转载自 http://blog.opskumu.com/docker.html 一、Docker 简介 Docke...
    极客圈阅读 13,578评论 0 120
  • 痴情少年郎, 蜷卧硬榻梦里思红妆! 只赴梦里安广厦, 不愿草堂言情伤。 泪掩浊目湿枕处, 梦醒又要话离殇, 惆怅!...
    残桥柴马阅读 1,267评论 0 0