All Products
Search
Document Center

Elastic Container Instance:Configure a container image

Last Updated:Apr 19, 2024

A container image contains the programs, library files, and configurations that are required to run containerized applications. This topic describes how to configure a container image when you create an elastic container instance.

Background information

Before you create an elastic container instance, you must upload a container image to your image repository. You can pull images from image repositories such as Docker Hub image repositories or Alibaba Cloud Container Registry (ACR) image repositories. We recommend that you use Container Registry to build, distribute, and manage container images. For more information, see What is Container Registry?

Usage notes

If you want to pull an Internet image that resides in a VPC in which no NAT gateway is created, you must associate an elastic IP address (EIP) with the elastic container instance.

Configuration description

Call an API operation

When you call the CreateContainerGroup API operation to create an elastic container instance, you can use parameters such as Container.N.Image to configure the container image. The following table describes the parameters. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

Container.N.Image

String

registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:latest

The image of container N.

InitContainer.N.Image

String

registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:latest

The image of init container N.

For images from different sources, you must also configure the following parameters:

  • If the image is stored in a private image repository, you must use the ImageRegistryCredential parameter to configure the access credential of the image repository.

    Parameter

    Type

    Example

    Description

    ImageRegistryCredential.N.Password

    String

    yourpassword

    The password that is used to access image repository N.

    ImageRegistryCredential.N.Server

    String

    registry-vpc.cn-hangzhou.aliyuncs.com

    The address of image repository N.

    ImageRegistryCredential.N.UserName

    String

    yourusername

    The username that is used to access image repository N.

  • If the image is stored in a Container Registry Enterprise Edition image repository, you can set the AcrRegistryInfo parameter to pull the image without using a secret. For more information, see Pull images from a Container Registry instance without using a secret.

  • If the image is stored in a self-managed image repository and the self-managed image repository uses the HTTP protocol or a self-issued certificate, you must configure the PlainHttpRegistry or InsecureRegistry parameter to prevent image pulling failures. For more information, see Pull an image from a self-managed image repository.

Use the Elastic Container Instance console

When you create an elastic container instance on the Elastic Container Instance buy page and configure a container on the Basic Settings step, you can select one of the following image types in the Container Configurations section:

  • Common Images: open source images that are provided by Elastic Container Instance for tests. You can use the images to fast test features of Elastic Container Instance.

  • Docker Official Images: public images that are provided by Docker Hub.

  • My Images: images that are stored in Container Registry Personal Edition image repositories.

  • Container Registry Enterprise Edition image: the images that are stored in Container Registry Enterprise Edition image repositories.

镜像

If the image is a private image, the system automatically enters the image address and tag in the Image field. In the next Other Settings (Optional) step, you must configure the access credential of the image. Private images refer to images that are not provided by Elastic Container Instance, Container Registry, or Docker Hub.

镜像仓库