当前位置:   article > 正文

06 - 分析docker run hello-world_hello world卡在pulling

hello world卡在pulling

在前面的《Centos7中安装及验证Docker》《Windows8中安装及验证Docker》两篇文章中都有看到:docker run hello-word,为了更深入的认识Docker,在这篇文章中着重讲解一下这句命令的作用和工作流程,从而更加深刻的认识Docker的工作原理。

  • 输入启动容器命令:
docker run hello-word
  • 1

将会出现:

C:\Users\zsl-pc>docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world

c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

说明:

Unable to find image 'hello-world:latest' locally:表示没有在本地找到镜像hello-world:latest

:latest:是指版本号或标记,同一个应用程序可能有多个版本或多个标记,我们可以通过修改latest来修改对应的版本信息。

latest: Pulling from library/hello-world:正在拉取镜像,也就是将该镜像下载到本地

c04b14da8d14: Pull complete:下载完成。

Hello from Docker!开始到最后就是hello-world这个镜像所做的工作,它只是输出了这样几句话。


当再次输入:docker run hello-world时,将不再出现类似Unable to find image 'hello-world:latest' locallypulling的字样,因为该镜像已经在本地存在,只需要直接run就行。

  • 查看现有镜像
C:\Users\zsl-pc>docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              c54a2cc56cbb        4 months ago        1.848 kB
  • 1
  • 2
  • 3

在这里可以看到这些镜像的仓库、标记、id、创建时间、大小等信息

  • 查看全部容器
C:\Users\zsl-pc>docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS
        NAMES
fcee30d727b4        hello-world         "/hello"            14 minutes ago      Exited (0) 13 minutes ago
        elated_feynman
e2eb5d0a9f96        hello-world         "/hello"            18 minutes ago      Exited (0) 16 minutes ago
        cranky_engelbart
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

在这里可以看到所有已经运行(过)的容器,包括:容器Id、对应镜像、命令行、创建时间、状态、端口号和名称。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/632128
推荐阅读
相关标签
  

闽ICP备14008679号