Skip to content

Commit

Permalink
Merge pull request #6 from inhandnet/pre-release
Browse files Browse the repository at this point in the history
Update doc
  • Loading branch information
soodifficult committed Jul 3, 2020
2 parents a4bdb9e + f4a09ab commit 5f3071b
Show file tree
Hide file tree
Showing 28 changed files with 109 additions and 7 deletions.
116 changes: 109 additions & 7 deletions Docker用户手册.md
Expand Up @@ -14,7 +14,13 @@ Docker 是一个开源的应用容器引擎,让开发者可以打包他们的
- [2.2.2 添加docker镜像](#add-docker-image)
- [2.2.3 配置并部署容器](#configure-and-deploy-container)
- [附录](#appendix)
- [在容器中调用串口进行通讯](#call-the-serial-port-in-the-container-for-communication)
- [设置容器永久运行](#set-the-container-to-run-permanently)
- [在IG902中运行Ubuntu](#run-ubuntu-in-ig902)
- [通过容器构建镜像(创建镜像保存容器配置)](#build-images-from-containers)
- [如何从gitlab/github上下载docker镜像](#how-to-download-docker-images-from-gitlab-github)
- [FAQ](#faq)


<a id="prepare-ig902-hardware-and-network-environment"> </a>

Expand Down Expand Up @@ -52,15 +58,15 @@ Docker 是一个开源的应用容器引擎,让开发者可以打包他们的
Docker SDK集成了运行docker镜像所需的运行环境以及docker镜像管理器,在使用Docker前必须先安装Docker SDK。如需获取Docker SDK请联系客服。 </br>
- 步骤1:已有Docker SDK后,进入IG902的“边缘计算>>Docker管理”页面,关闭Docker管理器并导入Docker SDK。

![](images/2020-02-11-15-44-40.png)
![](images/2020-07-01-15-54-37.png)

- 步骤2:导入后,IG902将自动安装Docker SDK,安装过程通常需要1-2分钟,请耐心等候。安装成功后,勾选启用Docker管理器并点击“提交”。

![](images/2020-02-11-09-12-14.png)
![](images/2020-07-01-16-10-00.png)

- 步骤3:启用Docker管理器后,可以修改访问Docker管理器的端口号和登录密码。

![](images/2020-02-11-14-09-18.png)
![](images/2020-07-01-16-11-37.png)

<a id="configure-docker-manager-portainer"> </a>

Expand All @@ -72,7 +78,7 @@ IG902使用Portainer构建,管理和维护Docker镜像和容器。关于Portai
#### 2.2.1 访问Portainer
- 步骤1:点击Portainer的访问按钮,随后Portainer会提示您需要输入用户名和密码。此时从IG902的“边缘计算>>Docker管理”页面复制用户名和设置的密码后并点击“登录”即可。

![](images/2020-02-11-14-10-38.png)
![](images/2020-07-01-16-12-08.png)

![](images/2020-01-14-16-02-20.png)

Expand All @@ -94,20 +100,28 @@ IG902使用Portainer构建,管理和维护Docker镜像和容器。关于Portai
为Portainer添加docker镜像的方法有两种:
- 方法1:从IG902的“边缘计算>>Docker管理”页面导入本地docker镜像。(导入所需时间根据docker镜像大小而不同;当docker镜像较大时,请耐心等待)

![](images/2020-02-11-14-11-20.png)
![](images/2020-07-01-16-17-22.png)

导入后在Portainer的“Local>>Images”页面可以看到导入成功的docker镜像。

![](images/2020-01-14-17-24-07.png)

- 方法2:进入Portainer的“Local>>Images”页面,从DockerHub中下载“nginx”docker镜像。(下载镜像所需时间根据镜像大小而不同;当docker镜像较大时,请耐心等待)

- 方法2:进入Portainer的“Local>>Images”页面,点击“Import”导入镜像

![](images/2020-06-29-14-50-49.png)

- 方法3:进入Portainer的“Local>>Images”页面,从DockerHub中下载“nginx”docker镜像。(下载镜像所需时间根据镜像大小而不同;当docker镜像较大时,请耐心等待)

![](images/2020-01-13-17-56-38.png)

docker镜像下载完成后如下图所示,在Portainer的“Local>>Images”中能够看到相应的docker镜像信息。

![](images/2020-01-13-18-02-33.png)

<font color=#FF0000>注意:因为IG902的CPU架构为linux/arm/v7,因此只有支持linux/arm/v7架构的镜像可以正常在IG902中运行,其他如window/amd64等架构的镜像可能无法正常导入、拉取或在IG902中运行。</font>

![](images/2020-06-28-15-20-14.png)

<a id="configure-and-deploy-container"> </a>

#### 2.2.3 配置并部署容器
Expand All @@ -131,6 +145,84 @@ IG902使用Portainer构建,管理和维护Docker镜像和容器。关于Portai

## 附录

<a id="call-the-serial-port-in-the-container-for-communication"> </a>

### 在容器中调用串口进行通讯
部署容器时,在Portainer的“Advanced container settings>>Volumes”页面添加一条“Volume mapping”。下图将IG902的dev目录中的文件映射到了容器中的dev目录下(IG902的dev目录中包含了相应的接口文件):

![](images/2020-06-29-10-21-33.png)

在Portainer的“Advanced container settings>>Runtime & Resouces”页面启用“Privileged mode”(未启用时使用串口会提示没有操作权限)

![](images/2020-06-29-10-29-12.png)

设置完毕后部署容器,随后在容器的console中进入dev目录可以看到`ttyO1``ttyO3`等接口文件。

![](images/2020-06-29-10-56-56.png)

<a id="set-the-container-to-run-permanently"> </a>

### 设置容器永久运行
部署容器时,在Portainer的“Advanced container settings>>Restart policy”页面选择“Restart policy”为“Always”,设置为“Always”后容器只要停止运行则会自动重启容器。

![](images/2020-06-29-10-41-54.png)

<a id="run-ubuntu-in-ig902"> </a>

### 在IG902中运行Ubuntu
- 步骤1:在Portainer的“Local>>Images”页面拉取Ubuntu镜像,如下图所示:

![](images/2020-06-29-13-45-37.png)

- 步骤2:进入Portainer的“Local>>Containers”页面,点击“Add container”以添加一个新容器。容器所使用的镜像选择上一步下载的Ubuntu镜像,同时在“Advanced container settings>>Command &logging”中勾选“Console”中的“Interactive & TTY (-i -t)”项。配置完成后点击“Deploy the container”部署容器。

![](images/2020-06-29-13-51-58.png)

![](images/2020-06-29-13-52-14.png)

- 步骤3:部署后在Portainer的“Local>>Containers”页面可看到容器已运行,点击“Exec Console”登录控制台。

![](images/2020-06-29-13-56-39.png)

在Exceute中点击“Connect”后进入容器内部运行相应命令。

![](images/2020-06-29-13-57-40.png)

![](images/2020-06-29-13-58-57.png)

<a id="build-images-from-containers"> </a>

### 通过容器构建镜像(创建镜像保存容器配置)
当容器中已配置好相应的开发或运行环境,如果需要保存容器中的环境配置,可以根据容器的更改创建一个新的镜像。方法如下(以Ubuntu容器安装ping工具为例):
- 步骤1:配置容器的开发或运行环境
分别运行`apt-get update``apt-get install inetutils-ping`命令安装ping工具。

![](images/2020-06-29-14-39-40.png)

![](images/2020-06-29-14-41-05.png)

- 步骤2:根据容器创建镜像
点击容器名称进入容器的详情页面

![](images/2020-06-29-14-42-28.png)

在详情页面的“Create image”中配置镜像的名称并点击“Creat”

![](images/2020-06-29-14-43-06.png)

- 步骤3:使用创建的镜像部署容器
镜像创建完成后可以在Portainer的“Local>>Images”页面查看

![](images/2020-06-29-14-45-39.png)

随后在Portainer的“Local>>Containers”页面通过创建的镜像来部署一个ubuntu容器,如下图所示:

![](images/2020-06-29-14-46-48.png)

登录该容器的控制台,可以正常使用ping命令

![](images/2020-06-29-14-47-58.png)

<a id="how-to-download-docker-images-from-gitlab-github"> </a>

### 如何从gitlab/github上下载docker镜像
Expand All @@ -149,3 +241,13 @@ IG902使用Portainer构建,管理和维护Docker镜像和容器。关于Portai
添加成功后,在拉取docker镜像时可以选择已配置的镜像仓库。

![](images/2020-01-19-10-45-04.png)


## FAQ
- Q1:在“Images”页面拉取镜像提示成功,但是在“Images”页面中未显示拉取到的镜像。

A1:因为IG902的CPU架构为linux/arm/v7,因此只有支持linux/arm/v7架构的镜像可以正常在IG902中运行,其他如window/amd64等架构的镜像可能无法正常导入、拉取或在IG902中运行。请确认拉取的镜像是否支持linux/arm/v7。

![](images/2020-06-28-15-25-10.png)

![](images/2020-06-28-15-25-46.png)
Binary file added images/2020-06-28-15-20-14.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-28-15-25-10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-28-15-25-46.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-10-21-33.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-10-29-00.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-10-29-12.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-10-41-54.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-10-56-56.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-13-45-37.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-13-51-58.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-13-52-14.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-13-56-39.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-13-57-40.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-13-58-57.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-14-39-40.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-14-41-05.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-14-42-28.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-14-43-06.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-14-45-39.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-14-46-48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-14-47-58.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-06-29-14-50-49.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-07-01-15-54-37.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-07-01-16-10-00.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-07-01-16-11-37.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2020-07-01-16-12-08.png
Binary file added images/2020-07-01-16-17-22.png

0 comments on commit 5f3071b

Please sign in to comment.