Elastic Container Instance (ECI) supports mounting volumes for persistent and temporary storage. This topic describes the supported volume types and how to declare and mount them using the API or the ECI console.
Why you need volumes
By default, container filesystems are ephemeral: data written inside a container exists only as long as the container itself. This creates two practical problems:
Data loss on restart: When a container crashes and restarts, all files written during the previous run are gone.
No cross-container sharing: Containers in the same elastic container instance cannot share files through the local filesystem.
Volumes solve both problems by providing storage that persists independently of the container lifecycle.
Volume types
ECI supports five volume types to cover different storage needs. Common use cases include:
Persisting database files so data survives container restarts
Sharing configuration files or log data across containers in the same instance
Storing unstructured data such as images and media files in object storage
Providing temporary scratch space for intermediate processing results
Injecting configuration data into a container
Choose a volume type based on two key criteria: whether data must survive a restart, and whether multiple instances need simultaneous access.
| Volume type | Description | Persistence | API mode | Console mode |
|---|---|---|---|---|
| Disk | Block storage with low latency, high performance, high durability, and high reliability. Suitable for databases and middleware. Can be mounted to one instance only — not a shared storage type. | Persistent | Supported | Not supported |
| NAS | Distributed file system (File Storage NAS) with shared access and auto scaling. Suitable for data sharing across instances, big data analysis, web applications, and log storage. Data is retained when the instance is deleted. | Persistent | Supported | Supported |
| OSS | Object storage (Object Storage Service) for unstructured data such as images and media files. Supports shared access across instances. Mounted via ossfs (a FUSE-based client). Optimized for reads — avoid write-intensive workloads. Data is retained when the instance is deleted. | Persistent | Supported | Supported |
| emptyDir | Temporary scratch space scoped to the container group. Data is cleared when the elastic container instance restarts. | Ephemeral | Supported | Supported |
| ConfigFile | Passes configuration data into the container group. | Ephemeral | Supported | Supported |
OSS volumes are mounted using ossfs, which is implemented as a Filesystem in Userspace (FUSE). For write-intensive workloads, use NAS or other volumes instead.
Configure volumes
Configuring a volume is a two-step process: declare the volume at the container group level, then mount it into a specific container. The declaration uses Volume.N.Name and Volume.N.Type; the mount uses Container.VolumeMount-related parameters.
API mode
When calling the CreateContainerGroup operation, declare each volume using the Volume.N.Name and Volume.N.Type parameters, then mount it using the Container.VolumeMount-related parameters.
The following table lists the supported values for Volume.N.Type.
Volume.N.Type value | Volume type | References |
|---|---|---|
EmptyDirVolume | emptyDir (temporary directory) | Mount an emptyDir volume |
ConfigFileVolume | ConfigFile (configuration file) | Mount a ConfigFile volume |
NFSVolume | NFS (NAS file system) | Mount a NAS volume |
FlexVolume | FlexVolume plug-in — supports Disk, NAS, and OSS | Mount a disk volume, Mount a NAS volume, and Mount an OSS bucket to an elastic container instance as a volume |
DiskVolumeis also a validVolume.N.Typevalue, but it is not recommended. UseFlexVolumeto mount a disk.
Console mode
When creating an elastic container instance on the Elastic Container Instance buy page, configure volumes in Container Group Configurations, then mount them in Container Configurations.
In the Container Group Configurations section, click Advanced Settings and specify a volume. The console supports the following volume types:
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.

Disk volumes are not supported in the console. Use the API to mount a disk.