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
+15-20Lines changed: 15 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,19 @@
2
2
title: Mount an Azure Files volume in Azure Container Instances
3
3
description: Learn how to mount an Azure Files volume to persist state with Azure Container Instances
4
4
services: container-instances
5
-
author: seanmck
5
+
author: dlepow
6
6
manager: jeconnoc
7
7
8
8
ms.service: container-instances
9
9
ms.topic: article
10
-
ms.date: 02/20/2018
11
-
ms.author: seanmck
10
+
ms.date: 11/05/2018
11
+
ms.author: danlep
12
12
ms.custom: mvc
13
13
---
14
14
15
15
# Mount an Azure file share in Azure Container Instances
16
16
17
-
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. This article shows how to mount an Azure file share for use with Azure Container Instances.
17
+
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. This article shows how to mount an Azure file share created with [Azure Files](../storage/files/storage-files-introduction.md)for use with Azure Container Instances. 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.
18
18
19
19
> [!NOTE]
20
20
> Mounting an Azure Files share is currently restricted to Linux containers. While we are working to bring all features to Windows containers, you can find current platform differences in [Quotas and region availability for Azure Container Instances](container-instances-quotas.md).
@@ -37,29 +37,24 @@ az storage account create \
37
37
--location $ACI_PERS_LOCATION \
38
38
--sku Standard_LRS
39
39
40
-
# Export the connection string as an environment variable. The following 'az storage share create' command
41
-
# references this environment variable when creating the Azure file share.
az storage share create --name $ACI_PERS_SHARE_NAME --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME
46
42
```
47
43
48
44
## Get storage credentials
49
45
50
46
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.
51
47
52
-
If you used the script above, the storage account name was created with a random value at the end. To query the final string (including the random portion), use the following commands:
48
+
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:
53
49
54
-
```azurecli-interactive
55
-
STORAGE_ACCOUNT=$(az storage account list --resource-group $ACI_PERS_RESOURCE_GROUP --query "[?contains(name,'$ACI_PERS_STORAGE_ACCOUNT_NAME')].[name]" --output tsv)
56
-
echo $STORAGE_ACCOUNT
50
+
```console
51
+
echo $ACI_PERS_STORAGE_ACCOUNT_NAME
57
52
```
58
53
59
54
The share name is 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:
@@ -84,7 +79,7 @@ The `--dns-name-label` value must be unique within the Azure region you create t
84
79
85
80
## Manage files in mounted volume
86
81
87
-
Once the container starts up, you can use the simple web app deployed via the [microsoft/aci-hellofiles][aci-hellofiles] image to manage the 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:
82
+
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:
88
83
89
84
```azurecli-interactive
90
85
az container show --resource-group $ACI_PERS_RESOURCE_GROUP --name hellofiles --query ipAddress.fqdn
@@ -94,11 +89,11 @@ You can use the [Azure portal][portal] or a tool like the [Microsoft Azure Stora
94
89
95
90
## Mount multiple volumes
96
91
97
-
To mount multiple volumes in a container instance, you must deploy using an [Azure Resource Manager template](/azure/templates/microsoft.containerinstance/containergroups).
92
+
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.
98
93
99
-
First, provide the share details and define the volumes by populating the `volumes` array in the `properties` section of the template. For example, if you've created two Azure Files shares named *share1* and *share2* in storage account *myStorageAccount*, the `volumes` array would appear similar to the following:
94
+
To use a template, provide the share details and define the volumes by populating the `volumes` array in the `properties` section of the template. For example, if you've created two Azure Files shares named *share1* and *share2* in storage account *myStorageAccount*, the `volumes` array would appear similar to the following:
100
95
101
-
```json
96
+
```JSON
102
97
"volumes": [{
103
98
"name": "myvolume1",
104
99
"azureFile": {
@@ -119,7 +114,7 @@ First, provide the share details and define the volumes by populating the `volum
119
114
120
115
Next, for each container in the container group in which you'd like to mount the volumes, populate the `volumeMounts` array in the `properties` section of the container definition. For example, this mounts the two volumes, *myvolume1* and *myvolume2*, previously defined:
121
116
122
-
```json
117
+
```JSON
123
118
"volumeMounts": [{
124
119
"name": "myvolume1",
125
120
"mountPath": "/mnt/share1/"
@@ -130,7 +125,7 @@ Next, for each container in the container group in which you'd like to mount the
130
125
}]
131
126
```
132
127
133
-
To see an example of container instance deployment with an Azure Resource Manager template, see [Deploy multi-container groups in Azure Container Instances](container-instances-multi-container-group.md).
128
+
To see an example of container instance deployment with an Azure Resource Manager template, see [Deploy a container group](container-instances-multi-container-group.md). For an example using a YAML file, see [Deploy a multi-container group with YAML](container-instances-multi-container-yaml.md)
0 commit comments