All Products
Search
Document Center

Use an NGINX image to create an elastic container instance

Last Updated: May 21, 2021

This topic describes how to pull an image from an Alibaba Cloud image repository to create an elastic container instance. In the example, an NGINX image is used.

Prerequisites

The following requirements are met:

  • Elastic Container Instance and Resource Access Management (RAM) are activated. The required RAM roles are authorized.

  • A virtual private cloud (VPC) and vSwitches are created in the region where you want to create an elastic container instance.

Procedure

This section describes the key configurations and steps of pulling an NGINX image from an Alibaba Cloud image repository to create an elastic container instance. For some parameters, only the minimum required or default configurations are used.

  1. Go to the elastic container instance buy page.

  2. Select a billing method.

  3. Select a region.

  4. Select a VPC and a vSwitch.

    To ensure that resources are sufficient to create the elastic container instance, we recommend that you specify multiple zones by selecting multiple vSwitches. The system preferentially creates the elastic container instance in a zone where resources are sufficient.

  5. Select a security group. Security groups function as virtual firewalls that provide Stateful Packet Inspection (SPI) and packet filtering capabilities to isolate security domains on the cloud. For elastic container instances, you can configure security group rules to allow or deny access to the Internet or internal network and access to or from specific IP addresses. For more information, see Overview.

    Note

    If you want to access elastic container instances in VPCs over the Internet, you must enable the required ports in the security groups to which the elastic container instances belong. For example, you must enable port 80 when you deploy the NGINX service. For more information, see Add security group rules.

  6. Configure the container group (elastic container instance) and specify the number of container groups that you want to purchase.

    1. Specify the number of vCPUs and memory size for the container group.

    2. Enter a name for the container group.

    3. Set Quantity to specify the number of container groups that you want to purchase.

      When you purchase multiple container groups, an incremental suffix is automatically added to the name based on the number of container groups that you purchase. For example, if you set Name to test and Quantity to 3, the names of your purchased container groups are test001, test002, and test003.

    Note

    By default, the instance restart policy (RestartPolicy) is Always, which indicates that a container automatically restarts if the container fails.

    1
  7. Configure containers.

    1. Enter a name for the container.

    2. Select an image and an image version.

      Click Select Image. On the Common Images tab, find eci_open/nginx and click Use on the left. Click Select Image Version and then select latest in the Image Version dialog box.

      Note

      • By default, the image pulling policy (imagePullPolicy) is IfNotPresent. IfNotPresent indicates that local images are preferentially used and images are pulled only if no local images are available.

      • Images whose source is ALI_HUB are stored in Alibaba Cloud image repositories (Container Registry) and can be pulled by using VPCs.

    2
  8. Click Confirm Configuration.

  9. Confirm the configurations, read and select Elastic Container Instance (ECI) Service Agreement, and then click Create Order.

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