All Products
Search
Document Center

Serverless App Engine:Add a sidecar container

Last Updated:Dec 17, 2025

Serverless App Engine (SAE) supports adding sidecar containers to applications to enhance the functionality of the main application container. Use sidecar containers to decouple and standardize non-business functions, such as monitoring and log collection. This approach separates auxiliary tasks from the main application container, which allows the main container to focus on its core business logic.

Entry points

  1. Create an application

    On the SAE Application List page, select a destination region and namespace in the top navigation bar, and then click Create Application. On the Application Basic Information page, configure the parameters and click Next: Advanced Settings.

    Change a running application

    Warning

    After you redeploy an application, the application is restarted. To prevent unpredictable errors such as business interruptions, we recommend that you deploy applications during off-peak hours.

    On the SAE Application List page, select a destination region and namespace in the top navigation bar. Click the ID of the target Application to open the application details page.In the navigation pane on the left, click Basic Information. In the upper-right corner, click Deploy Application.

    Change a stopped application

    On the SAE Application List page, select a destination region and namespace in the top navigation bar. Click the ID of the target Application to open the application details page.Click Basic Information, and then click Modify Application Configuration.

  2. Expand the Add sidecar container section, and then click Add.

Configuration guide

In the Sidecar Container panel that appears, configure the following parameters and click OK.

  1. Specify a custom Container Name for the sidecar.

  2. Based on the image source for the sidecar, select Images of Current Alibaba Cloud Account or Custom Image.

    • Images of Current Alibaba Cloud Account: Select an image from an ACR repository that belongs to the current Alibaba Cloud account. You can use Container Registry Personal Edition or Container Registry Enterprise Edition.

      Prerequisite: Create an image and push it to an ACR image repository that belongs to the current account. For more information, see Image creation examples, Build images using Enterprise Edition instances, or Push and pull images using Personal Edition instances.

      • Container Registry Personal Edition: Specify the required sidecar image by selecting an Image Repository Namespace, Image Repository Name, and Image Version.

        vTeZoL9MmK

      • Container Registry Enterprise Edition: Specify the required sidecar image by selecting an instance from the Enterprise Instance List, an Image Repository Namespace, an Image Repository Name, and an Image Version.

        BbeCU5cAwC

    • Custom Image: Select an image from a private image repository of another Alibaba Cloud account or a third-party image repository.

      • Private image repository of another Alibaba Cloud account:

        If the main container's image is pulled from an ACR repository of another Alibaba Cloud account, the sidecar container can also pull an image from an ACR repository of that same account. The sidecar automatically reuses the acrAssumeRoleArn and secret that are configured for the main container.

        Enter the full Registry Address. The format is <Registry Address>:<Image Version>. Example: registry.cn-beijing.aliyuncs.com/sae-demo-******:nginx.

      • Third-party image repository:

        To pull an image from a third-party image repository, such as Docker Hub, Harbor, or GitHub Container Registry, ensure that the registry address is accessible over the public network.

        Enter the full Registry Address. The format is <Image Name>:<Image Tag>. Example: registry.openanolis.cn/******/nginx:1.14.1-8.6.

        Important

        By default, SAE applications cannot access resources or services on the public network. For example, they cannot pull images from public image repositories. To resolve this issue, you can enable an Internet NAT gateway for the VPC where the application resides. For more information, see Configure an Internet NAT gateway to allow an SAE application to access the Internet.

  3. You can set the CPU Limit and Memory Limit for the Sidecar Container.

    Note

    Sidecar containers share CPU and memory resources with the main application container. To ensure the main container runs correctly, set appropriate resource limits for the sidecar container to prevent it from using too many resources.

  4. (Optional) Click Advanced Settings and configure the following parameters for the sidecar container as needed.

    1. In the Startup Command section, configure a startup command for the sidecar container. For more information, see Set startup commands.

    2. In the Environment Variables section, configure environment variables for the sidecar container. For more information, see Set environment variables.

    3. In the Configuration Management section, inject configuration information into the sidecar container by mounting ConfigMap files. For more information, see Inject configuration information.

    4. In the Shared Temporary Storage section, set a temporary storage directory and mount it to both the main application container and the sidecar container.

      P5mEGEthgv

      Note

      The temporary storage name can contain only lowercase letters, numbers, and hyphens (-).

Verify the results

  • On the Log Management > Real-time Logs page, view the real-time logs of the main application container and the sidecar container.

    bxdfVR6Pvk

  • On the Instances page, use Webshell to log on to the container. On the Webshell page, view the details of the main application container and the sidecar container.

    7B9SAGcjVz

  • Check whether the test directory exists in the /tmp directory of both the main application container and the sidecar container.