Azure Container Instances

Container Volume Mounts in Azure Container Instances

Azure Container Instances (ACI) allows you to mount Azure storage volumes to your containers. This is crucial for persisting data, sharing data between containers within a group, or providing configuration files.

Supported Volume Types

ACI supports two primary types of volumes:

Mounting an Azure File Share

To mount an Azure File Share, you'll need the following information:

Example: Using Azure CLI

Here's how you can mount an Azure File Share when creating a container instance group using the Azure CLI:

az container create \
  --resource-group myResourceGroup \
  --name myContainerGroup \
  --image myImage:latest \
  --azure-file-volume-account-name  \
  --azure-file-volume-account-key  \
  --azure-file-share-name myFileShare \
  --azure-file-volume-mount-path /mnt/data

Mounting an Empty Dir Volume

Empty Dir volumes are simpler to configure. You just specify the mount path within the container.

Example: Using Azure CLI

To mount an Empty Dir volume:

az container create \
  --resource-group myResourceGroup \
  --name myContainerGroup \
  --image myImage:latest \
  --empty-dir-volume-mount-path /tmp/cache

Use Cases for Volume Mounts

Data Persistence

Ensure your application's data survives container restarts or restarts of the container group.

Data Sharing

Share data or configuration files between multiple containers within the same container group.

Configuration Management

Provide configuration files or secrets to your containers from a central location.

Caching

Use volumes for caching frequently accessed data to improve application performance.

Considerations

For more advanced configurations and details, please refer to the official Azure documentation.