All Products
Document Center

Elastic Container Instance:Use an NGINX image to create an elastic container instance

Last Updated:Mar 08, 2024

If you want to test the capabilities of Elastic Container Instance, you can use common images such as NGINX images provided by Elastic Container Instance. This topic describes how to pull an NGINX image over a virtual private cloud (VPC) and use the NGINX image to create an elastic container instance.


  • Elastic Container Instance and Resource Access Management (RAM) are activated. Your RAM role is granted the required permissions.


    If you create an elastic container instance as a RAM user, you must grant the required permissions to the RAM user. For more information, see Grant permissions to a RAM user.

  • vSwitches and a VPC are created in the region where you want to create an elastic container instance.

    • For information about the regions and zones where Elastic Container Instance is available, see Regions and zones.

    • For information about how to create a VPC and vSwitch, see Create and manage a VPC and Create and manage a vSwitch.


      We recommend that you create multiple vSwitches. This way, you can select multiple vSwitches to implement the multi-zone feature when you create an elastic container instance. This improves the success rate of instance creation.

  • A security group is created. For more information, see Create a security group.

    Security groups serve as virtual firewalls that provide Stateful Packet Inspection (SPI) and packet filtering capabilities to isolate security domains on the cloud. Each elastic container instance must belong to a security group. For more information, see Assign a security group to an elastic container instance.


This section describes the key configurations and steps of pulling an NGINX image to create an elastic container instance. For specific parameters, the minimal or default configurations are used.

  1. Go to the elastic container instance buy page.

  2. Configure the basic information of the instance.

    1. Specify the billing method and type of the instance.

      Use the default settings Pay-as-you-go and Regular Instance.

    2. Select the region in which you want to create the elastic container instance.

    3. Select a VPC and a vSwitch.

      We recommend that you select multiple vSwitches to implement the multi-zone feature. The system preferentially creates the instance in a zone where inventory resources are sufficient.

    4. Select a security group. You can configure security group rules to allow or deny access from elastic container instances in a security group to the Internet or a VPC, and access among IP addresses.


      If you want to access elastic container instances in a VPC over the Internet, you must enable corresponding ports in the security group to which the elastic container instances belong. For more information, see Add a security group rule.

  3. Configure the container group.

    1. Specify specifications for the container group.

      In this example, the instance is created by using vCPU and memory specifications. This creation mode provides better elasticity and resource provisioning capabilities. If your business requires special specifications, such as GPU-accelerated instances, you can specify corresponding Elastic Compute Service (ECS) instance types. For more information, see Specify ECS instance types to create an elastic container instance.

    2. Enter a name for the container group.

    3. Select a restart policy.

      The default value is Always, which specifies that the system automatically restarts a container when the container exits.


  4. Set the Quantity parameter.

    If you purchase multiple container groups, a sequential suffix is automatically appended to the name of each container group. For example, if you set Name to test and Quantity to 3, the names of your container groups are test001, test002, and test003.

  5. Configure containers.

    1. Enter a name for the container.

    2. Select an image and an image tag.

      Click Select Container Image. On the Common Images tab, find eci_open/nginx and click Use on the right. Click Select Image Tag and then select 1.14.2 in the Image Tag dialog box.

      • The default image pulling policy that is specified by the imagePullPolicy parameter is IfNotPresent. IfNotPresent specifies that on-premises images are preferentially used and images are pulled only if no on-premises images are available.

      • Images whose source is ALI_HUB are stored in Alibaba Cloud image repositories. By default, the images are pulled over VPCs.



    Elastic Container Instance does not support port mapping. The container ports that are exposed by default are enabled for instances. In the preceding example, port 80 is exposed by default on the NGINX image that you select. If the security group allows port 80, you can use the instance IP address and port number to access NGINX containers.

  6. Click Confirm Configuration.

  7. Verify the configurations, read and select the terms of service, and then click Confirm Order.

    After the elastic container instance is created, you can view it on the Container Group page and click the instance ID to go to the instance details page.