All Products
Search
Document Center

Elastic Container Instance:Create an ECI instance by pulling an image from Docker Hub

Last Updated:Jun 20, 2026

By default, ECI instances do not have public network access to pull images. Therefore, to create an ECI instance by pulling an image from an external repository such as Docker Hub, the instance must have public network access. This topic describes how to create an ECI instance by pulling an image from Docker Hub.

Prerequisites

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

    Note

    If you create an ECI 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 ECI instance.

    • For information about the regions and zones where ECI 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.

      Note

      We recommend creating multiple vSwitches. This way, you can select multiple vSwitches to implement the multi-zone feature when you create an ECI 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 ECI instance must belong to a security group. For more information, see Assign a security group to an ECI instance.

Procedure

This section describes the key steps to create an ECI instance by pulling the busybox image from Docker Hub as an example. For some settings, the default or simplest configuration is used.

  1. Go to the Elastic Container Instance buy page.

  2. Click Confirm Configuration.

  3. Confirm the instance configuration, read and select the terms of service, and then click Confirm Order.

    After the instance is created, you can view it on the Container Group page. Click the instance ID to view its details.

  4. Configure the basic information of the instance.

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

      Use the default settings. The billing method is pay-as-you-go, and the instance type is regular instance.

    2. Select the region in which you want to create the ECI 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. Security group rules allow or deny access for ECI instances to the public internet or within the VPC, and control access between IP addresses.

      Note

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

  5. 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 ECI instance.

    2. Enter a name for the container group.

    3. Select a restart policy.

      The default value is Always, which means the system automatically restarts the container after it exits.

  6. Configure the container.

    1. Enter a container name.

    2. Select an image and its version.

      On the Docker Official Images tab, select busybox and set the version to latest.

      Note
      • The image pull policy (imagePullPolicy) defaults to IfNotPresent. This means the system first tries to use a local image. If the image is not found locally, it is pulled from the repository.

      • Images from the DOCKER_HUB source are from Docker Hub and must be pulled over the public network.

    3. Set the startup command.

      To ensure the busybox container runs properly, set a startup command. In this example, use sleep 999999.

  7. If no NAT Gateway is created in the selected VPC, click Next: Other Settings and then associate an EIP with the instance.

    In the EIP section, select Auto Create or Use Existing based on your needs. After an EIP is associated, the instance gains public network access and can be reached from the public network through the EIP.

    • Auto Create: The automatically created EIP uses pay-as-you-go billing and supports cost offsets with Shared Bandwidth. You must set the peak bandwidth.

    • Use Existing: You can select an existing, unassociated EIP from the drop-down list.

    Important

    By default, ECI instances do not have public network access to pull images. To pull images from Docker Hub or other external image repositories, either create a NAT Gateway and configure SNAT in your VPC, or associate an EIP with your ECI instance. Without this network configuration, the image pull will fail. For more information, see Configure public network access.