Create a Docker gateway template with container-specific system properties and metrics, and associate the container Thing template to it.
Prerequisites
- The gateway template must have commands relevant to the container runtime actions such as, pull, create, rm, and rmi.
- The Client ID must match the container client ID when a VMware Pulse IoTC Agent connection is established. The template client ID and the container client IDs are configurable, but they must be the same.
- You must have the CREATE DEVICE TEMPLATE permission to perform this operation.
Procedure
- From the VMware Pulse IoT Center UI, go to Inventory > Device Templates.
The Inventory - Device Templates screen is displayed.
- Click CREATE.
The Create Device Template wizard is displayed.
- In the Details step, enter the template name and select the device type as Gateway. To associate an image with your gateway, click UPLOAD IMAGE. Click Next.
- In the Properties step, add the following system properties and click NEXT:
- downloaded-images: The container images that are downloaded to the gateway.
- running-containers: The containers that are running on the gateway.
- all-containers: A list of all containers on the gateway.
Note: The system properties are case-sensitive.
- In the Metrics step, add the following Docker-related metrics and click NEXT.
- num-containers: the total number of containers.
- num-running-containers: The number of containers that are running on the gateway.
- num-images: The number of images on the gateway.
- In the Connected Device Templates step, add the container Thing template that you created. You can add multiple container Thing templates here. Click NEXT.
- In the Commands step, enter the following Docker commands for your gateway.
Note:
- Ensure that you select Client Command as the command type.
- The Client Identifier must match the container client ID when a VMware Pulse IoTC Agent connection is established. The template client ID and the container client IDs are configurable, but they must be the same. The client ID can be found at the following location in your gateway:
/opt/vmware/iotc-client/conf/plugin_conf/container-management.cfg
For example: root@photon-machine [ ~ ]# cat /opt/vmware/iotc-client/conf/plugin_conf/container-management.cfg
{
"interface":{
"type":"c",
"name":"container-management",
"init":"InitializePlugin"
},
"clientId": "com.vmware.containermgmt.client",
"commandInterval":300,
"propertyInterval":600,
"metricInterval":300,
"properties":[],
"metrics" : [
{"name": "num-containers", "type": "integer"},
{"name": "num-running-containers", "type": "integer"},
{"name": "num-images", "type": "integer"},
{"name": "network-bytes-in", "type": "integer"},
{"name": "network-bytes-out", "type": "integer"},
{"name": "cpu", "type": "double"},
{"name": "memory", "type": "double"}
]
}
- You can configure the default values in the container-management.cfg file. Ensure that you restart the Container Management service for the changes to take effect.
Command Name |
Argument Name |
Value |
pull: The command to pull an image. |
image_name |
The image name. This value can be changed when you send the command. |
create: The command to enroll the container to VMware Pulse IoT Center. |
pulse_template
container_name
image_name
options
|
- The container template name.
- The container name.
- The image used for creating the container.
- Any Docker related options.
|
run: The command to pull, create, and start a container. |
pulse_template
container_name
image_name
options
|
- The container template name.
- The container name.
- The image used for creating the container.
- Any Docker related options.
|
rm: The command to remove a container from VMware Pulse IoT Center. |
container_name |
The name of the container to remove. |
rmi: The command to remove a container image from VMware Pulse IoT Center. |
image_name |
The image name to remove. |
- In the Enrollment Provider step, select an appropriate method to authenticate your gateway enrollment and click NEXT.
- In the Settings step, click NEXT.
- In the Review step, review the information that you have entered and click SAVE.
Results
You have successfully created a Docker gateway template and associated a container Thing template to it.
What to do next
Onboard your Docker gateway.