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.
Introduction to volumes
By default, files in containers are ephemeral and stored on temporary disks. This creates the following challenges for applications:
When a container crashes, its files are lost upon restart.
Files cannot be shared between containers running in the same elastic container instance.
To solve these problems, Elastic Container Instance uses volumes for persistent storage. The following table describes the types 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:
| 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:
| 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:
| Supported | Supported |
EmptyDir | emptyDir volumes provide temporary storage. Data in an emptyDir volume is lost if the elastic container instance to which it is mounted is restarted. 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 must first declare it and then mount it to a container.
API mode
When you call the CreateContainerGroup API operation to create an elastic container instance, you can declare the name and type of the volume by using the Volume.N.Name and Volume.N.Type parameters. Then, you need to configure additional 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. | |
ConfigFileVolume | A ConfigFile volume, which indicates a configuration file. | |
NFSVolume | An NFS volume, which indicates a network file system, such as a NAS file system. | |
FlexVolume | A volume mounted by using the FlexVolume plug-in. This supports disks, NAS file systems, and OSS buckets. |
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.
Click Advanced Settings in the Container Group Configurations section and specify a volume.

The Elastic Container Instance console supports only the following volume type:
Configuration item (ConfigFile)
Temporary directories (emptyDir)
NAS persistence (NFS)
OSS persistence (FlexVolume)
In the Container Configurations section, click Advanced Settings next to a container to mount the volume to the container.
