All Products
Search
Document Center

CloudOps Orchestration Service:Docker image deployments

Last Updated:Dec 15, 2025

Use this deployment type to publish applications from Docker images stored in an Enterprise Edition instance of Container Registry (ACR).

To deploy from a Personal Edition of ACR or a third-party image repository, use a command-only deployment.

How it works

Important
  • If you deploy to an ESS scaling group, scaling activities are paused during the deployment. The activities automatically resume after the deployment is complete, regardless of whether it succeeds or fails.

  • The deployment process first stops the old version and then starts the new one. Each deployment runs the stop script before it runs the start script.

  • The Docker image is automatically pulled to the Elastic Compute Service (ECS) instance during deployment. Do not include an image pull command in the start script.

  1. Create and publish the deployment.

    Configure the application source file, start script, and stop script for the deployment.

    Create a release task, select a release mode, and publish the deployment to the target application group.

  2. Automated deployment flow.

    1. Retrieves the deployment information. This includes the Docker image details and the application's start and stop scripts.

    2. Pulls the Docker image from the image repository to the ECS instance.

    3. Runs the stop script to stop the old version of the application.

    4. Runs the start script to start the new version of the application.

Scope

  • Deployments are supported only on Linux instances.

  • The start and stop scripts must be Shell scripts.

Procedure

  1. Prepare the application, group, and ECS instances.

    Before you deploy, create an application and a group in ECS Application Management. Then, add your ECS instances to the group.

    1. If you do not have an ECS instance, create one that runs a Linux operating system from the ECS console - Custom Launch page.

      We recommend using an ECS image of Alibaba Cloud Linux 3.2104 LTS 64-bit or Ubuntu 22.04 64-bit. The scripts in the following examples are based on these two images. If you use a different image, modify the scripts as needed.
    2. Go to the ECS console - Application Management page, click Create from Existing Resources, create an application and an application group, and import the ECS instance into the application group.

    3. Install Docker on the ECS instances in the group. On the O&M tab of the application group, select ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL to install Docker in a batch.

      If your ECS instance was created from a custom image, you cannot install extensions this way. You must remotely connect to the instance and manually install Docker.
  2. Create a Docker image deployment.

    1. Pull the sample image to your local machine. Then, push the image to your ACR Enterprise Edition instance repository.

      docker pull aliyun-computenest-opensource-registry.cn-hangzhou.cr.aliyuncs.com/default/aliyun-code-deploy:latest
    2. Go to the ECS console - Application Management page. On the My Applications tab, click the name of the target application.

    3. On the application product page, select the Deployment tab, and then click Create Deployment.

    4. On the Create Deployment page, set RevisionType to Docker Image, and configure the following key parameters.

      • ACR instance information: Enter the details for your ACR Enterprise Edition instance. After you enter the image version, the system automatically generates a Registry Address. Use this address in the application start script.image

      • Working directory: The execution directory for the application start and stop scripts. Example: /root/deploy.

      • Application start script: Replace <Registry Address> with the actual address.

        ### The Docker image is automatically pulled to the ECS instance during deployment. You can start the container directly.
        ### Start the current version of the container
        function start_application() {
          image_name="<Registry Address>"
          container_name="my-container"
          docker run -d -p 8080:8080 --name ${container_name} ${image_name}
        }
        
        start_application
      • Application stop script:

        function stop_application() {
          # Query whether the container exists by the container name, and delete the container if it exists
          container_name="my-container"
          container_id=$(docker ps -aq -f name=${container_name}) 
          if [ -n "$container_id" ]; then
            docker rm -f $container_id
          fi
        }
        
        stop_application
    5. After you configure all parameters, click OK to save the deployment.

  3. Return to the deployment list. Find the deployment that you created and click Publish. Select the target group and click OK to start the deployment.

  4. Verify the result.

    1. Go to the details page of the target instance. Click Connect and select Workbench. Follow the prompts on the page to log on to the terminal.

    2. Run the curl http://localhost:8080/hello command. A return value of Alibaba Spring Sample! indicates that the deployment was successful.

Key fields

Field

Description

Container Registry region

The region where the ACR Enterprise Edition instance is located.

Container Registry instance ID

ACR Enterprise Edition instance ID

Namespace

The namespace where the image repository is located.

Repository name

The name of the image repository.

Image version

The version of the Docker image to be deployed.

Pull image over private network

If you choose to pull the image over the private network, make sure the ACR instance and the ECS instance are in the same virtual private cloud (VPC). You must also have configured access control for the VPC.
Otherwise, the image is pulled over the Internet. In this case, make sure both the ECS instance and the ACR instance are configured for public network access.

Working directory

The working directory for the application's start and stop scripts.

  • Enter an absolute path.

  • You can enter a directory that does not exist. It is created automatically during execution.

Application start script

The Shell script used to start the application.

Application stop script

The Shell script to stop the application.
The script must correctly stop the current and previous versions of the application. When no application is running, the script must also exit normally without errors.

For example, the following script stops a container named my-container. This script assumes that every version of the container has the same name. The script does not report an error if the container does not exist:

container_name="my-container"
container_id=$(docker ps -aq -f name=${container_name}) 
if [ -n "$container_id" ]; then
  docker rm -f $container_id
fi