All Products
Search
Document Center

Elastic Container Instance:Overview of volumes

Last Updated:Nov 01, 2024

You can mount volumes to elastic container instances as persistent storage. This topic describes the volumes that can be mounted to elastic container instances and how to configure the volumes.

Volume type

Files in containers are temporarily stored on disks. Temporary storage causes the following issues to applications that run in containers.

  • If a container fails, the files that generated during the running of the container are not retained when the container is rebuilt. The files are lost.

  • When multiple containers run in the same elastic container instance, files cannot be shared among the containers.

To address the preceding issues, Elastic Container Instance uses volumes as persistent storage. The following table describes the type of volumes that Elastic Container Instance supports.

Volume type

Description

API mode

Console mode

Disks

Disks are block-level storage products provided by Alibaba Cloud. Disks feature low latency, high performance, high durability, and high reliability. For more information, see Disks.

Disks are suitable for the following scenarios:

  • High I/O and low-latency

    Disks feature low latency and high performance. They are suitable for scenarios that have high requirements for I/O and latency, such as scenarios in which databases and middleware are stored.

  • Non-data sharing

    Disks are not shared storage and can be mounted to only one instance.

Supported

Not supported

NAS

File Storage NAS (NAS) is a distributed file system provided by Alibaba Cloud. NAS supports shared access and auto scaling. NAS features high reliability and high performance. For more information, see What is NAS?

NAS is suitable for the following scenarios:

  • Data sharing

    NAS is a shared storage type. You can access data on NAS from multiple instances at the same time. The data on NAS volumes is not deleted when the instance is deleted. NAS volumes can be used to share data between instances.

  • Big data analysis

    NAS file systems provide high throughput and meet the requirement of shared storage access when large numbers of jobs are involved.

  • Web applications

    NAS file systems can provision storage for web applications and content management systems.

  • Log storage

    If you want to persistently store logs, we recommend that you use NAS volumes.

Supported

Supported

OSS

Object Storage Service (OSS) is a secure, cost-effective, and highly reliable Alibaba Cloud storage service that allows you to store large volumes of unstructured data, such as images and audio and video data. For more information, see What is OSS?

OSS volumes are suitable for the following scenarios:

  • Data sharing

    OSS is a shared storage type. You can access data on OSS from multiple instances at the same time. The data on OSS volumes is not deleted when the instance is deleted. OSS volumes can be used to share data between instances.

  • Read-only configuration files of websites and applications

    The network performance of ossfs is not as good as those of local file systems. ossfs can support the read of small files.

  • Read-only media files such as images and audio and video files

    OSS volumes are suitable for storing unstructured data. You can read images and audio and video files from OSS volumes.

    Note

    OSS volumes are mounted by using ossfs, which is implemented as a file system in user space (FUSE). OSS volumes are not stable in scenarios that have high requirements for write speed. We recommend that you use other volumes such as NAS in scenarios that have high requirements for write speed.

Supported

Supported

EmptyDir

emptyDir volumes are temporary directories that are used to temporarily store data and share data among containers. The data in an emptyDir volume is cleared when the instance is deleted.

Important

emptyDir volumes are temporary storage. When an elastic container instance to which an emptyDir volume is mounted is restarted, the data stored in the emptyDir volume is also cleared.

Supported

Supported

ConfigFile

The configuration file that is used to pass in configuration data of an elastic container instance.

Supported

Supported

Configuration description

To use a volume, you need to specify the volume and then mount the volume to a container.

API mode

When you call the CreateContainerGroup API operation to create an elastic container instance, you can specify the name and type of the volume by using the Volume.N.Name and Volume.N.Type parameters. Then, you need to configure more parameters based on the value of Volume.N.Type.

Value of Volume.N.Type

Description

References

EmptyDirVolume

An emptyDir volume, which indicates a temporary directory.

Mount an emptyDir volume

ConfigFileVolume

A ConfigFile volume, which indicates a configuration file.

Mount a ConfigFile volume

NFSVolume

An NFS volume, which indicates a network file system, such as a NAS file system.

Mount a NAS volume

FlexVolume

A volume that is mounted by using the FlexVolume plug-in. These volumes include disks, NAS file systems, and OSS buckets.

Note

DiskVolume is also a valid value of Volume.N.Type, which indicates a disk volume. We do not recommend that you use the DiskVolume value. If you want to mount a disk, we recommend that you use the FlexVolume value.

After you specify a volume, you can use Container.VolumeMount-related parameters to mount the volume to a container.

Console mode

When you create an elastic container instance on the Elastic Container Instance buy page, you can specify volumes in the Container Group Configurations section and then mount the volumes to containers in the Container Configurations section.

  1. Click Advanced Settings in the Container Group Configurations section and specify a volume.

    Volumes

    The Elastic Container Instance console supports only the following volume type:

    • Configuration item (ConfigFile)

    • Temporary directories (emptyDir)

    • NAS persistence (NFS)

    • OSS persistence (FlexVolume)

  2. In the Container Configurations section, click Advanced Settings next to a container to mount the volume to the container.

    Volume 2