In this example, we pull container images to a Docker Gateway and create containers using the container images. We also perform the start, stop, and remove operations on the containers and container images, using the VMware Pulse IoT Center console.

Prerequisites

  • Enable and run the Docker service in your gateway.
  • Install Container Management in your gateway using Campaigns.
  • Create a Docker gateway template with system properties, metrics, and add the Docker commands using the Client Commands feature. Use this template to enroll your gateway to the VMware Pulse IoT Center server.
  • Create Thing templates (container images) with system properties, metrics, and start and stop client commands.
Note: After sending a command, you must wait for its status to change from Pending to the Executed state before sending another command. Click the refresh button for the status to change.

Procedure

  1. From the VMware Pulse IoT Center console, enroll the Docker gateway to the VMware Pulse IoT Center server.
  2. After the Docker gateway is enrolled, click the Properties tab and verify that the downloaded-images and running-containers properties do not have any values.
  3. Click the Metrics tab and verify that the num-images, num-containers, and num-running-containers metric values are 0.
  4. To pull the metrics and properties information of the container images, perform the following steps:
    1. Select Commands from the drop-down menu and click SEND COMMAND.
    2. In the Send Command window, select pull from the Select Command drop-down menu and enter the name of the container image under Arguments.
    3. Click SEND COMMAND.
    The Command History section displays the pull command as Executed. Click the Properties tab of the Docker gateway. The container images are displayed under System Properties. The Metrics tab displays the number of images as 1.
  5. To create containers using the container images, perform the following steps:
    1. From the Docker gateway, select Commands from the drop-down menu and click SEND COMMAND.
    2. In the Send Command window, select create from the Select Command drop-down menu.
    3. Under pulse_template, type the container Thing template name that you created.
    4. Under container_name, enter a name for the container.
    5. Under image_name, enter the container image name that you have pulled.
    6. Click SEND COMMAND.
    The Command History section displays the create command as Executed. Click the Properties tab of the Docker gateway. The containers are enrolled and are displayed under All Containers. Select any of the containers from the Devices - All Devices page and click Properties. The status of the container is Created. Select the Docker gateway and click Metrics. The num-images, and num-containers, metric values are 1. The value of num-running-containers is 0.
  6. To start the containers, perform the following steps:
    1. From the Devices - All Devices page, select a container, go to > Commands, and click SEND COMMAND.
    2. In the Send Command window, select start from the Select Command drop-down menu and click SEND COMMAND.
    The Command History section displays the start command as Executed. Click the Properties tab of the Docker gateway. The containers are displayed under running-containers. Select the Metrics tab. The value of num-running-containers is 1.
  7. To combine the pull, create, and start operations, use the run command. This command pulls, creates, and starts the containers using the container images. Perform the following steps:
    1. From the Docker gateway, select Commands from the drop-down menu and click SEND COMMAND.
    2. In the Send Command window, select run from the Select Command drop-down menu.
    3. Under pulse_template, type the container Thing template name that you created.
    4. Under container_name, enter a name for the container.
    5. Under image_name, enter the container image name that you have pulled.
    6. Click SEND COMMAND.
    The Command History section displays the create command as Executed. Click the Properties tab of the Docker gateway. The containers are enrolled and are displayed under All Containers. Select any of the containers from the Devices - All Devices page and click Properties. The status of the container is Created. Select the Docker gateway and click Metrics. The value of the num-images, num-containers, and num-running-containers metrics are 2.
  8. To stop the containers, perform the following steps:
    1. From the Devices - All Devices page, select a container and go to > Commands, and click SEND COMMAND.
    2. In the Send Command window, select stop from the Select Command drop-down menu and click SEND COMMAND.
    The Command History section displays the stop command as Executed. Click the Metrics tab of the Docker gateway. The value of the num-running-containers metric is 1.
  9. To remove the containers, perform the following steps:
    1. From the Docker gateway, select Commands from the drop-down menu.
    2. In the Send Command window, select rm from the Select Command drop-down menu.
    3. Under Arguments, enter the container name to remove and click SEND COMMAND.
    The Command History section displays the remove command as Executed. The Enrollment State of the containers are Unenrolled. Click the Metrics tab of the Docker gateway. The value of the num-all-containers metric is 1.
  10. To remove the container images, perform the following steps:
    1. From the Docker gateway, select Commands from the drop-down menu.
    2. In the Send Command window, select rmi from the Select Command drop-down menu.
    3. Under Arguments, enter the container image name to remove and click SEND COMMAND.
    The Command History section displays the remove image command as Executed. Click the Metrics tab of the Docker gateway. The value of the num-images metric is 1.