InGateway902 Docker user manual¶
InGateway902 series edge computing gateway (IG902 for short) supports manage docker images. You can publish your docker images to IG902 to quickly deploy and run applications developed by yourself. In order to introduce how to use IG902’s Docker environment, this document will demonstrate how to run an Nginx image on IG902. This image is used for open source reverse proxy server for HTTP, HTTPS, SMTP, POP3 and IMAP protocols, and load balancer, HTTP cache And web server.
Docker is an open source application container engine that allows developers to package their applications and dependencies into a portable container and then publish it to any popular Linux machine or Windows machine. It can also be virtualized. The container is completely with the sandbox mechanism, there will be no interface between each other.
- 1. Prepare IG902 Hardware and Network Environment
- 2. Enable and configure Docker manager
- Appendix
- FAQ
1. Prepare IG902 Hardware and Network Environment¶
1.1 Connect IG902 to the Power Source and to a PC with a Network Cable¶
Connect IG902 to the power source and to a PC with an Ethernet cable according to the topology diagram.
1.3 Connect IG902 to the Internet¶
Connect IG902 to the Internet by referring to Connect IG902 to the Internet.
1.4 Update the firmware¶
To obtain the latest firmware version of IG902 and updated functions, please visit the Resource. To update the IG902 firmware, see Update the IG902 software version. (The firmware version should be 2.0.0.r12057 and above)
2. Enable and configure Docker manager¶
2.1 Install Docker SDK and enable Docker manager¶
The Docker SDK integrates the operating environment and docker image manager required to run the docker image. Before using Docker, you must install the Docker SDK. To obtain the Docker SDK, please visit the Resource.
Step 1: If you already have the Docker SDK, choose Edge Computing > Docker Manager page of IG902, close the Docker Manager and import the Docker SDK.
Step 2: After importing, IG902 will automatically install the Docker SDK. The installation process usually takes 1-2 minutes. Please be patient. After successful installation, select Enable Docker Manager and click Submit.
Step 3: Then you can modify the port number and login password to access the Docker manager.
2.2 Configure Docker Manager–Portainer¶
IG902 uses Portainer to build, manage and maintain Docker images and containers. For a detailed introduction and instructions on Portainer, please see the Portainer official website. This document will show you how to add and deploy an Nginx docker image on IG902.
2.2.1 Access Portainer¶
Step 1: Click Portainer’s access button, and Portainer will prompt you to enter your username and password. At this time, copy the user name and the set password from the Edge Computing > Docker Manager page of IG902 and click Login.
Step 2: After the login is successful, as shown in the figure below, select Local to use the Portainer to manage the docker image on the IG902, and then click Connect.
Step 3: On the Home page of Portainer, select local to manage the docker image on IG902.
Then you will jump to the local dashboard, where you can get an overview of the IG902’s containers and images.
2.2.2 Add docker image¶
There are two ways to add docker images for Portainer:
Method 1: Enter the Local > Images page of Portainer. click “Import” to import the image.
Method 2: Choose Local > Images page of Portainer and download the nginx docker image from DockerHub. (The time required to download the image varies depending on the size of the image; please be patient when the docker image is large)
After the docker image is downloaded, you can see the corresponding docker image information in Local > Images as shown below:
Note: The architecture of IG902 CPU is linux/arm/v7. Only images that support linux/arm/v7 architecture can run normally in IG902. Images of other architectures,such as window/amd64, may not be imported, pulled, or run successfully in IG902.
2.2.3 Configure and deploy container¶
Step 1: Choose Local > Containers page of Portainer and click Add container to add a new container.
Step 2: Configure the operating parameters for the container and deploy the container.
Step 3: The container will run automatically after deployment. You can view the container running status on Portainer’s Local > Containers page.
Step 4: After entering the Nginx access link (IP address + port number of IG902) configured in the container in the browser, you can see the Nginx welcome page.This shows that the Nginx docker image has been running on the IG902 normally. Now, you have completed adding and deploying an Nginx docker image on the IG902.
Appendix¶
Use Serial port for communication in container¶
When deploying the container, add Volume Mapping to the Advanced Container Settings > Volumes page of the Portainer. The following figure maps the files in the dev directory of IG902 to the dev directory in the container (The corresponding interface file is included in the dev directory of IG902).
Enable Privileged mode on the Advanced Container Settings > Runtime & Resouces page of the Portainer (if it is not enabled, using the serial port will prompt that there is no operation authority).
At this time you can deploy the container. Enter the dev directory of the container’s console, you can find the interface files such as ttyO1
and ttyO3
.
Set the container to run permanently¶
On the Advanced Container Settings > Restart Policy page of the Portainer, set the Restart policy state as Always. Then the container will automatically restart as long as it stops running.
Run Ubuntu in IG902¶
Step 1: Pull the Ubuntu image on the Local > Images page of the Portainer, as shown below:
Step 2: Go to Local > Containers page of the Portainer, click Add container to add a new container. Select the Ubuntu image downloaded in the previous step as the containers image. At the same time, click Advanced Container Settings > Command & Logging, check Interactive & TTY in the Console. After the configuration is complete, click Deploy the container to deploy the container.
Step 3: After deployment, on the Local > Containers page of Portainer, you can see that the container is running. Click on Exec Console to log in to the console.
Click on Connect in Execute page, and then enter the container to run the corresponding command.
Build the image through a container (create an image to save the container configuration)¶
When the corresponding development or operating environment has been configured in the container, if you need to save the environment configuration, you can create a new image based on the container’s changes. The method is as follows (take the ping tool installation in the Ubuntu container as an example):
Step 1: Configure the development or runtime environment of the container.
Run the
apt-get update
andapt-get install inetutils-ping
commands to install the ping tool.Step 2: Create an image based on the container.
Click on the container name to enter the details of the container page.
Configure the name of the image in the Create Image on the details page and click on Create.
Step 3: Use the created image to deploy the container.
After the image is created, you can view it in Local > Images page of Portainer.
Then deploy an ubuntu container using the image on the Local > Containers page of Portainer. As shown below:
Log in to the console of the container, you can use your ping command.
How to download docker images from gitlab / github¶
Choose Local > Registries page of Portainer and click Add registry to add a docker mirror repository (must be a public repository).
Then select Custom registry and configure the mirror repository information. After configuration, click Add registry.
After the mirror repository is successfully added, you can see the web page as shown below:
After the addition is successful, you can select the configured image repository when pulling the docker image.
FAQ¶
Q1:It prompted succeed after pulling image on the “Images” page, but the image is not shown on the “Images” page.¶
A1: That is because the architecture of IG902 CPU is linux/arm/v7. Only images that support linux/arm/v7 architecture can run normally in IG902. Images of other architectures, such as window/amd64, may not be imported, pulled, or run successfully in IG902.