Docker Hello-World镜像运行测试
一、命令:docker run hello-world
命令解释:以docker客户端命令的方式运行hello-world镜像
命令运行结果:
hadoop@Docker:/opt/docker$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
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.
(amd64)
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 ID:
https://hub.docker.com/ For more examples and ideas, visit:
通过分析命令运行结果,说明docker内部的工作原理:
(1)加载本地镜像
# 首先在本地查找'hello-world:latest'镜像
Unable to find image 'hello-world:latest' locally
docker run一个镜像,那么则会以这个镜像作为类的模板生成一个hello-world容器实例,一个具体的对象。注意:该命令首先会查找本地的hello-world镜像。
(2)从阿里云服务器上拉去hello-world镜像
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9fde470971e499788
Status: Downloaded newer image for hello-world:latest
(3)、运行
Hello from Docker!
This message shows that your installation appears to be working correctly.
(4)运行原理分析

首先,我们在docker客户端(命令行终端窗口),执行docker命令;
客户端回去访问我们docker所在的那台服务器主机,实质而言主机上有一个Docker daemon主线程,它会监听到客户端的docker命令,它会run容器(Container),而容器又是通过镜像生成的。如果没有hello-world容器,它就会在本地查找hello-world镜像,如果本地找到了就会直接生成一个hello-world容器,否则,会向阿里云服务器仓库拉去相应的镜像;
从阿里云服务器仓库上拉取hello-world镜像到本地,再生成容器,进而运行。
(5)docker容器终止运行
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.
(amd64)
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 ID:
https://hub.docker.com/ For more examples and ideas, visit:
https://docs.docker.com/get-started/
输出这段提示以后,hello world就会停止运行,容器自动终止
二、run到底做了什么呢?
docker run hello-world命令运行原理图:

Docker Hello-World镜像运行测试的更多相关文章
- Docker的ubuntu镜像安装的容器无ifconfig和ping命令的解决
Docker的Ubuntu镜像安装的容器无ifconfig命令和ping命令 解决: apt-get update apt install net-tools # ifconfig apt ...
- 关于Docker官方CentOS镜像无法启动mysqld的总结
很多童鞋反映,在Docker官方CentOS镜像中安装了Mysql server后,无法正常启动. 无法正常启动表现为两种情况: 1> 初始完数据库后,mysqld启动报错 2> syst ...
- 理解docker容器和镜像(layer,ufs)和docker命令解释
博客好文1:http://blog.csdn.net/x931100537/article/details/49633107(理解docker容器和镜像,理解简单,从原理入手,什么是layer,什么是 ...
- 4.docker学习之镜像
镜像 我们知道,我们想在Windows操作系统上跑Linux,需要安装一个虚拟机程序,然后下载一个Linux镜像,在该虚拟机程序中创建一个虚拟机,并使用该镜像安装对应的Linux操作系统,安装好之后, ...
- 容器与Docker简介(四)Docker容器,镜像与 Registries——微软微服务电子书翻译系列
当使用Docker时,开发人员创建一个应用程序或服务,并将其和其依赖关系打包到容器镜像中. 镜像是应用程序或服务及其配置和依赖的静态表示形式. 要运行应用程序或服务,应用程序的镜像将被实例化以创建一个 ...
- docker之NGINX镜像构建
Nginx是一个高性能的Web和反向代理服务器,它具有很多非常优越的特性:1.作为Web服务器.2.作为负载均衡服务器.3.作为邮件代理服务器.4.安装及配置简单.接下来我们介绍在docker构建ng ...
- Docker 中国官方镜像加速
参考:https://www.docker-cn.com/registry-mirror 通过 Docker 官方镜像加速,中国区用户能够快速访问最流行的 Docker 镜像.该镜像托管于中国大陆,本 ...
- Docker公共&本地镜像仓库(七)--技术流ken
分发镜像 我们已经会构建自己的镜像了,那么如果在多个docker主机上使用镜像那?有如下的几种可用的方法: 用相同的Dockerfile在其他host上构建镜像 将镜像上传到公共registry(比如 ...
- docker简单介绍----镜像和容器管理
docker可以分为三部分:docker镜像 docker仓库 docker容器 docker镜像:一个image可以包含一个镜像,也可以理解为一个系统模板,里面安装了相关应用,也可以是纯净版的 ...
随机推荐
- Visual Studio 调试系列4 单步后退来检查旧应用状态(使用使用 IntelliTrace 窗口)
系列目录 [已更新最新开发文章,点击查看详细] IntelliTrace 后退会在每个断点处及调试器步骤事件发生时自动拍摄应用程序的快照. 凭借记录的快照便可以返回到上一个断点或步骤,并查看当 ...
- gulp的初阶使用方法(转)
安装好gulp之后接下来就是使用了,此文主要介绍一些前端开发时常用的一些插件及其用法 http://www.imooc.com/article/tag/26/hot/12插件安装 安装本地服务器插件: ...
- PyQt5笔记之标签
标签 QLabel用于显示文本或图像.没有提供用户交互功能.标签的视觉外观可以通过各种方式进行配置,并且可以用于为另一个窗口小部件指定焦点助记键. 一个QLabel可以包含以下任意内容类型: 内容 设 ...
- select2的简单使用
静态下拉列表 修改 type_template.html 引入JS <!-- slect2插件--> <link rel="stylesheet" href=& ...
- 第十九节:Asp.Net Core WebApi基础总结和请求方式
一. 基础总结 1.Restful服务改造 Core下的WebApi默认也是Restful格式服务,即通过请求方式(Get,post,put,delete)来区分请求哪个方法,请求的URL中不需要写方 ...
- 【spring boot】【idea】100.idea新建一个spring boot项目
1.idea新创建一个项目 2.setting进入,选择自己的Maven 3.简单补充一下pom.xml <?xml version="1.0" encoding=" ...
- .Net工具类--表达式目录树解析DataReader和DataTable
一.概述 在项目中经常会使用SQL去操作数据库,在读取数据的时候返回结果一般是DataReader和DataSet,其中DataaSet里面可以包含多个DataTable. 读取到数据之后,一般情况下 ...
- 在VB编程中,若一行代码太长需要换行时,行尾要加什么符号
& _ 注意,&与_之间一定要有一个空格 例如: aa="select " & _ " a,b,c" & _ ...
- Lisp : (quote) code is data (eval) data as code
- vue 强制刷新 demo 神器
this.$forceUpdate() /*关键句,强制更新dom*/