For deployments that use Docker container images, we recommend using a container image deployment package. Compute Nest provides a public Container Registry (ACR) instance to host and store images, where each service provider is assigned a unique namespace for multi-tenancy. This topic describes the use cases for container image deployment packages, explains how they work, and shows you how to create and use them.
Use cases
For private deployments that pull Docker container images from the public internet, you can use a container image deployment package with a temporary key.
Container image deployment packages do not support auto scaling or frequent image pulls after the initial deployment.
How it works
To ensure multi-tenancy, container images from different service providers are stored in a shared repository but isolated by namespace. Each service provider is mapped to a unique namespace. When uploading or pulling an image, a temporary key is generated for the namespace based on the service provider's AliUid. Access control is enforced at the namespace level.
Implementation
You must define the following two placeholders in your service's Resource Orchestration Service (ROS) template. These placeholders are replaced with actual values during deployment.
-
{{ computenest::acrimage::yourimage }}: A placeholder for the container image deployment package. During deployment, Compute Nest replaces this with the URL of the associated container image, such ascompute-nest-registry.cn-hangzhou.cr.aliyuncs.com/aliUid1/volcanosh/vc-controller-manager:1.0. -
{{ computenest::acr::dockerconfigjson }}: A placeholder for the image pull credential. During deployment, this is replaced with a temporary key used to pull the private container image.
The following YAML example shows how to use a container image deployment package. The pull credential placeholder {{ computenest::acr::dockerconfigjson }} is deployed as a Secret named computenestrepo. This Secret is then used as the imagePullSecret to pull the container image after the image placeholder is replaced.
Create and use
Prerequisites
You must have Docker installed and a Docker image created. If not, see Install and use Docker.
Create a deployment package
-
Configure basic information for the deployment package.
-
Log on to the Compute Nest console. In the left-side navigation pane, choose Service Deployment Package. On the Packages tab, click Create Deployment Package.
-
In the Basic Information section, configure the following parameters.
Parameter
Description
Deployment Package Name
The name can contain Chinese characters, English letters, digits, and underscores (_). The name must be 3 to 128 characters long, where a Chinese character counts as two characters. The deployment package name cannot be changed after creation.
Version Name
The name can contain Chinese characters, English letters, digits, and underscores (_). The name must be 3 to 50 characters long, where a Chinese character counts as two characters.
Description
The description must be 10 to 500 characters long. A Chinese character counts as two characters.
Resource Group
Select the resource group to which the deployment package belongs.
Resource groups allow you to group your cloud resources by usage, permissions, or ownership, enabling hierarchical resource management for multiple users and projects within an organization. For more information, see resource groups.
Tag Settings
Select or enter a complete tag key and tag value to add a tag to the deployment package. You can bind up to 20 tags to a resource. If no tag keys or values are available, you can create a custom tag. For more information, see Create and bind a custom tag.
-
-
Configure the container image deployment package.
This section uses uploading an
apache-php5image as an example.-
In the Deployment Package Content section, set Deployment Package Type to Container Image.
-
Click Obtain Access Credential to get the commands for uploading your container image to the Compute Nest repository.
After you obtain the credential, the page displays the required commands. First, log on to the Compute Nest image repository with the
docker logincommand. Next, after entering the Image Name and Tag (for example,latest), tag your local image by using thedocker tagcommand. Finally, push the tagged image to the repository with thedocker pushcommand.-
Log on to your command-line tool and run the login command to access the Compute Nest image repository.
docker login compute-nest-registry.cn-hangzhou.cr.aliyuncs.com --username=cr_temp_user --password=<temporary_token> -
Tag your container image for the Compute Nest image repository.
docker tag registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5:latest compute-nest-registry.cn-hangzhou.cr.aliyuncs.com/lxepoo/apache-php5:latest -
Push the tagged container image.
docker push compute-nest-registry.cn-hangzhou.cr.aliyuncs.com/156345785543852/registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5:latest The push refers to repository [compute-nest-registry.cn-hangzhou.cr.aliyuncs.com/156345785543852/registry.cn-hangzhou.aliyuncs.com/lxepoo/apache-php5] 6bb81559e239: Pushed cea911103474: Pushed cc523d99ead5: Pushed b00b1ec7b8ef: Pushed 7715ecdbe18e: Pushed 5e755f0e0b5c: Pushed 2a1ce34e52b6: Pushed 28dc854edc91: Pushed 24fc817b31ed: Pushed 7cd75a52f72c: Pushed 05b156d2bc54: Pushed 8cc36998586f: Pushed ab73fa68e475: Pushed dbf739521f53: Pushed 3e019add9ad9: Pushed 18e3751aa1ef: Pushed 4eb95f543324: Pushed a594229cce80: Pushed 69a54e38f06b: Pushed d2808f8124fd: Pushed fe4c16cbf7a4: Pushed latest: digest: sha256:2afcd2b89f317e0570325817f4e8d9c93f12ac781779e365e456ae37aa297f7a size: 4700
-
-
After the push is successful, in the Container Image section, choose the image you uploaded and click Publish Deployment Package.
-
-
View the deployment package.
-
Return to the Service Deployment Package page. Click the name of the deployment package to go to the Deployment Package Details page and view its status.
-
When the status changes to Available, the package is created.
-
Use the deployment package
This section explains how to use a container image deployment package when creating a private deployment service.
-
Log on to the Compute Nest console.
-
In the left-side navigation pane, click My Services. On the Created Services tab of the My Services page, click Create Service.
-
On the Create New Service page, select Custom launch as the creation method, select Private Service as the service type, and click Next: Configure Settings.
-
Enter the basic service information and enter the ROS template as required.
In the ROS template, define the
{{ computenest::acr::dockerconfigjson }}placeholder for the access credential and the{{ computenest::acrimage::yourimage }}placeholder for the container image within theALIYUN::CS::ClusterApplicationresource. -
In the Deployment Package Association section, Set Container Image Association. Click Select Deployment Package. In the dialog box that appears, select the deployment package and version, and then click OK to associate the container image deployment package.
-
After you create and test the service, perform a self-check against the service release criteria and submit it for review. For more information, see Review criteria.
-
After the service is created, you can view the deployment package association on the service details page.
On the service details page, click the Deployment Package Association tab, and then the Container Image Association tab to view the association between the placeholder (such as
{{ computenest::acrimage::nginx }}) and its corresponding deployment package information.
Related documents
-
For more information about how to create a service in Compute Nest, see Create a service.
-
You can delete a deployment package or one of its versions if it is no longer needed. For more information, see Delete a deployment package.
-
To change the content or other information of a deployment package, create a new version. For more information, see Create a new version.
-
To set the update configuration for a deployment package, see Configure service upgrades.