Skip to content

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:

  1. Change Directory to: Your App Home Folder.

  2. Copy the file : docker-compose.yml to : <<app name>>-docker-compose.yml.

  3. Edit the file: <<app name>>-docker-compose.yml.

Remember:

  • <app name> is the name of your app (e.g., courseapp in our example).
  • <tag name> is the tag associated with your app image (e.g., 0.0.0 in our example).

It should look like this:

---
services:
  courseapp:
    image: courseapp:0.0.0
    container_name: courseApp
    read_only: true
    labels:
      com.sensiaglobal.image.config_manager_reg_name: courseApp
    restart: on-failure
    networks:
      - network1
    ports:
      - "8100:8100"
    environment:
      HCC2_SDK2_API_URL: "http://hcc2RestServer_0:7071/api/v1"
      SDK2_CALLBACK_URL: "http://courseapp:8100/webhook/v1"
    tmpfs:
      - /tmp:uid=5678,gid=5678
    volumes:
      - courseapp_config_vol:/app/config
      - courseapp_data_vol:/app/data
networks:
  network1:
    name: edgenet
    external: true

volumes:
  courseapp_config_vol:
    name: courseapp_config_vol
  courseapp_data_vol:
    name: courseapp_data_vol
...

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. Replace the image: parameter 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/restapi_sample_interface/<<appname>>-docker-compose.yml $HOME/edgesdk_devtools

Result

You are now ready to sign your application.