You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-instances/container-instances-volume-azure-files.md
+22-17Lines changed: 22 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
title: Mount Azure Files volume to container group
3
3
description: Learn how to mount an Azure Files volume to persist state with Azure Container Instances
4
4
ms.topic: article
5
-
ms.date: 07/08/2019
5
+
ms.date: 12/30/2019
6
6
ms.custom: mvc
7
7
---
8
8
9
9
# Mount an Azure file share in Azure Container Instances
10
10
11
-
By default, Azure Container Instances are stateless. If the container crashes or stops, all of its state is lost. To persist state beyond the lifetime of the container, you must mount a volume from an external store. As shown in this article, Azure Container Instances can mount an Azure file share created with [Azure Files](../storage/files/storage-files-introduction.md). Azure Files offers fully managed file shares in the cloud that are accessible via the industry standard Server Message Block (SMB) protocol. Using an Azure file share with Azure Container Instances provides file-sharing features similar to using an Azure file share with Azure virtual machines.
11
+
By default, Azure Container Instances are stateless. If the container crashes or stops, all of its state is lost. To persist state beyond the lifetime of the container, you must mount a volume from an external store. As shown in this article, Azure Container Instances can mount an Azure file share created with [Azure Files](../storage/files/storage-files-introduction.md). Azure Files offers fully managed file shares hosted in Azure Storage that are accessible via the industry standard Server Message Block (SMB) protocol. Using an Azure file share with Azure Container Instances provides file-sharing features similar to using an Azure file share with Azure virtual machines.
12
12
13
13
> [!NOTE]
14
14
> Mounting an Azure Files share is currently restricted to Linux containers. Find current platform differences in the [overview](container-instances-overview.md#linux-and-windows-containers).
@@ -35,29 +35,33 @@ az storage account create \
35
35
--sku Standard_LRS
36
36
37
37
# Create the file share
38
-
az storage share create --name $ACI_PERS_SHARE_NAME --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME
38
+
az storage share create \
39
+
--name $ACI_PERS_SHARE_NAME \
40
+
--account-name $ACI_PERS_STORAGE_ACCOUNT_NAME
39
41
```
40
42
41
43
## Get storage credentials
42
44
43
45
To mount an Azure file share as a volume in Azure Container Instances, you need three values: the storage account name, the share name, and the storage access key.
44
46
45
-
If you used the script above, the storage account name was stored in the $ACI_PERS_STORAGE_ACCOUNT_NAME variable. To see the account name, type:
47
+
***Storage account name** - If you used the preceding script, the storage account name was stored in the `$ACI_PERS_STORAGE_ACCOUNT_NAME` variable. To see the account name, type:
46
48
47
-
```console
48
-
echo $ACI_PERS_STORAGE_ACCOUNT_NAME
49
-
```
49
+
```console
50
+
echo $ACI_PERS_STORAGE_ACCOUNT_NAME
51
+
```
50
52
51
-
The share nameis already known (defined as *acishare* in the script above), so all that remains is the storage account key, which can be found using the following command:
53
+
***Share name** - This value is already known (defined as `acishare` in the preceding script)
To mount an Azure file share as a volume in a container by using the Azure CLI, specify the share and volume mount point when you create the container with [az container create][az-container-create]. If you've followed the previous steps, you can mount the share you created earlier by using the following command to create a container:
64
+
To mount an Azure file share as a volume in a container by using the Azure CLI, specify the share and volume mount point when you create the container with [az container create][az-container-create]. If you followed the previous steps, you can mount the share you created earlier by using the following command to create a container:
61
65
62
66
```azurecli-interactive
63
67
az container create \
@@ -79,14 +83,15 @@ The `--dns-name-label` value must be unique within the Azure region where you cr
79
83
Once the container starts up, you can use the simple web app deployed via the Microsoft [aci-hellofiles][aci-hellofiles] image to create small text files in the Azure file share at the mount path you specified. Obtain the web app's fully qualified domain name (FQDN) with the [az container show][az-container-show] command:
80
84
81
85
```azurecli-interactive
82
-
az container show --resource-group $ACI_PERS_RESOURCE_GROUP --name hellofiles --query ipAddress.fqdn --output tsv
86
+
az container show --resource-group $ACI_PERS_RESOURCE_GROUP \
After saving text using the app, you can use the [Azure portal][portal] or a tool like the [Microsoft Azure Storage Explorer][storage-explorer] to retrieve and inspect the file written to the file share.
90
+
After saving text using the app, you can use the [Azure portal][portal] or a tool like the [Microsoft Azure Storage Explorer][storage-explorer] to retrieve and inspect the file or files written to the file share.
86
91
87
92
## Deploy container and mount volume - YAML
88
93
89
-
You can also deploy a container group and mount a volume in a container with the Azure CLI and a [YAML template](container-instances-multi-container-yaml.md). Deploying by YAML template is the preferred method when deploying container groups consisting of multiple containers.
94
+
You can also deploy a container group and mount a volume in a container with the Azure CLI and a [YAML template](container-instances-multi-container-yaml.md). Deploying by YAML template is a preferred method when deploying container groups consisting of multiple containers.
90
95
91
96
The following YAML template defines a container group with one container created with the `aci-hellofiles` image. The container mounts the Azure file share *acishare* created previously as a volume. Where indicated, enter the name and storage key for the storage account that hosts the file share.
92
97
@@ -223,7 +228,7 @@ az group deployment create --resource-group myResourceGroup --template-file depl
223
228
224
229
## Mount multiple volumes
225
230
226
-
To mount multiple volumes in a container instance, you must deploy using an [Azure Resource Manager template](/azure/templates/microsoft.containerinstance/containergroups) or a YAML file. To use a template or YAML file, provide the share details and define the volumes by populating the `volumes` array in the `properties` section of the template.
231
+
To mount multiple volumes in a container instance, you must deploy using an [Azure Resource Manager template](/azure/templates/microsoft.containerinstance/containergroups), a YAML file, or another programmatic method. To use a template or YAML file, provide the share details and define the volumes by populating the `volumes` array in the `properties` section of the file.
227
232
228
233
For example, if you created two Azure Files shares named *share1* and *share2* in storage account *myStorageAccount*, the `volumes` array in a Resource Manager template would appear similar to the following:
0 commit comments