All Products
Search
Document Center

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

Last Updated:Mar 24, 2023

Elastic Container Instance provides common images such as NGINX images to allow you to test features of Elastic Container Instance. This topic describes how to use a common image that is pulled over a virtual private cloud (VPC) to create an elastic container instance. In this topic, an NGINX image is used.

Prerequisites

The following requirements are met:

  • Elastic Container Instance and Resource Access Management (RAM) are activated. Your RAM role is granted the permissions that are required to assume your Alibaba Cloud account.

  • A 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 to create an elastic container instance. For some 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. Select the billing method and type of the instance.

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

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

    3. 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 instance in a zone where resources are sufficient.

    4. Select 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. You can configure security group rules to allow or deny elastic container instances in security groups access to the Internet or an internal network, and access among IP addresses. For more information, see Overview.

      Note

      If you want to access elastic container instances in VPCs from the Internet, you must enable corresponding ports in the security group to which the elastic container instance belongs. For more information, see Add a security group rule.

  3. Configure the container group and quantity.

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

    2. Enter a name for the container group.

    3. Select a container restart policy.

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

    4. Specify whether to automatically match image caches.

      If you select Automatically Match Image Cache, the system matches image caches to accelerate the creation of the instance. If no image cache is matched, the system automatically creates an image cache when the system creates the instance. Next time you create an elastic container instance that uses a similar image, the image cache can be used to accelerate instance creation.

    5. Set Quantity. This parameter specifies the number of container groups that you want to purchase.

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

    Getting started 1
  4. 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.

      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. By default, the images are pulled over VPCs.

    Getting started 2
    Note

    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.

  5. Click Confirm Configuration.

  6. 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 the instance on the Container Group page and click the instance ID to go to the instance details page.