• Cloud Container Engine

  1. Help Center
  2. Cloud Container Engine
  3. User Guide
  4. Operation Guide
  5. Component Template

Component Template

A component template defines the container image address, network protocol, communications port, memory capacity, CPU capacity, volumes, and environment variables.

You can create a component template using the container image you have uploaded.

Creating a Component Template

  1. In the navigation pane of the CCE console, choose Component Template. On the Component Template page, click Create Component Template.
  2. On the Create Component Template page, specify template parameters.

    Figure 1 Defining a component template
    • Template Name
      Name of the component template to be created.

      A component template name must:

      • Be 1 to 24 characters long. Only lowercase letters, digits, and hyphens (-) are allowed.
      • Begin with a lowercase letter.
    • Container Image

      Name and version number of the container image that will be used to create the component template.

      Container images are classified into two types:

      • Internal container image, which is stored in CCE's container registry.
      • External container image, which is stored in container registries from other sources.
    • Network and Port

      Network protocol and listening port used by the component. A maximum of 10 ports can be added.

    • Memory and CPU

      Memory capacity and CPU capacity of the component.

      CPU capacity is measured in mcores. 1 core is equal to 1000 mcores.


      The memory capacity and CPU capacity defined in a component template cannot exceed those of the node on which the containerized application will run. Otherwise, creating the containerized application will fail.

    • Support uncapped CPU

      If only one container supports uncapped CPU, the container can use available resources on the node, in addition to the CPU capacity of the container.

      If multiple containers support uncapped CPU, they can additionally share available resources on the node on a percentage basis. For example, if the CPU capacity of container A is 100 mcores and the CPU capacity of container B is 300 mcores, then they share available resources on the node at a ratio of 1:3.

    • Volumes

      A volume mounts an absolute path on a host (also called a node) into a path on a container, thereby achieving sharing between hosts and containers. A maximum of 10 volumes can be configured.

      The current CCE version supports only EVS plug-ins.

      There are two ways to define a volume:

      • Specify the Volumes parameter on either the Create Component Template page or the Create App Design page of the CCE console
      • Run the docker run command with the -v option

        For example, to mount the /src/webapp directory on a host to the /opt/webapp directory on the frontend container, run the following command:

        docker run -d -P --name frontend -v /src/webapp:/opt/webapp frontend

      If the Volumes parameter is configured, storage will be added for the application when the application is being created from the component template. The application's storage space is the host path on the node where the application is deployed

      Another way to add storage for the application is to use APIs to create the application and then add storage.

      PersistentVolume is a storage resource. CCE supports three PersistentVolume types: hostpath, nfs, and hwsElasticVolumeService. The PersistentVolumes of hostpath type deliver the same functions as the Volumes configured on the CCE console. For details about PersistentVolumes of nfs and hwsElasticVolumeService types and related APIs, see Cloud Container Engine API Reference.

    • Environment Variables

      An environment variable refers to a container runtime variable. A maximum of 30 environment variables can be defined in a component template. The variables of a containerized application can be modified even after the application is deployed, allowing for great flexibility in application management.

      There are two ways to define an environment variable:

      • Specify the Environment Variables parameter on the CCE console
      • Specify the ENV parameter in the Dockerfile
    • To avoid information leakage, ensure that environment variables do not contain sensitive information such as usernames and passwords.
    • If sensitive information is required, encrypt it before writing it into an environment variable. The sensitive information is decrypted only when an application uses the environment variable.

  3. Click OK to complete the creation of the component template.

Modifying a Component Template

  1. On the Component Template page, click Modify in the same row as the component template you will modify.
  2. On the Modify Component Template page, modify template parameters.

    For details, see 2 in Creating a Component Template.

  3. Click Update.

    The "Template modified successfully" message is then displayed.

Viewing a Component Template

  1. On the Component Template page, click View in the same row as the component template you will view.

    Information about the component template is then displayed.

  2. View the component template information.

Deleting a Component Template

  1. On the Component Template page, click Delete in the same row as the component template you will delete.
  2. In the Delete Component Template dialog box, click OK to confirm that you want to proceed with the deletion