Container Preparation
HCC2 Docker containers require packaging into a Mender file and then signing before they can be deployed to a HCC2 device.
The first step is to prepare the docker-compose.yml
that will be used to deploy your application container each time the HCC2 is started.
Danger
Review the Rules & Best Practices section before designing your application. Poorly designed/poorly written applications can impact HCC2 performance, and/or degrade the life expectancy of flash storage.
Editing docker-compose.yml
In your development environment:
-
Change Directory to:
Your App Home Folder
. -
Copy the file :
docker-compose.yml
to :<app name>-docker-compose.yml
-
Edit the file:
<app name>-docker-compose.yml.
Remember:
<app name>
is the name of your app (e.g.pyapp
for our example).<tag name>
is the tag associated with your app image (e.g.0.0.0
for our example).
It should look like this:
---
services:
pyapp: # name of your app
image: sdk-docs/pyapp:0.0.0 # image source/ tag (used in the Docker push)
container_name: pyApp # name of your app
restart: on-failure
read_only: true
labels:
com.sensiaglobal.image.config_manager_reg_name: pyApp
networks:
- network1
environment:
HOST: modbus_0 # HCC2 Modbus Server host (internal hostname, for external use IP address)
PORT: 25002 # HCC2 Modbus Server port (internal port that maps to 502 externally)
UNIT: 1 # Modbus client unit
TIME_PERIOD: 1000 # time between polls (ms)
CONTROL_TIME_PERIOD: 1000 # time between controls (ms)
TIMEOUT: 500 # reply timeout (ms)
RETRIES: 1 # number of retries
tmpfs: # map to temp dir
- /temp:uid=5678,gid=5678
volumes: # define container
- vol1:/app-dir1 # internal persistence
networks:
network1:
name: edgenet
external: true
volumes: # volumes definition
vol1:
name: vol1
...
Important
The name of your application in the line "container_name" MUST BE CamelCase, exactly as you have defined it in creating your application. All other appearances of your application name must be in all lower case.
4. The image:
parameter should be replaced with your Docker image path/location.
5. When you finish editing your application yml file, copy it to your edgesdk_devtools folder.
For example, run the following commands:
cp $HOME/edgesdkexample/<appname>-docker-compose.yml $HOME/edgesdk_devtools
Result
You are now ready to sign your application.