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-apps/storage-mounts-azure-files.md
+3-6Lines changed: 3 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Tutorial: Create an Azure Files storage mount in Azure Container Apps"
2
+
title: "Tutorial: Create an Azure Files volume mount in Azure Container Apps"
3
3
description: Learn to create an Azure Files storage mount in Azure Container Apps
4
4
services: container-apps
5
5
author: craigshoemaker
@@ -10,12 +10,9 @@ ms.date: 07/19/2022
10
10
ms.author: cshoe
11
11
---
12
12
13
-
# Tutorial: Create an Azure Files storage mount in Azure Container Apps
13
+
# Tutorial: Create an Azure Files volume mount in Azure Container Apps
14
14
15
-
Learn to write to permanent storage in a container app using an Azure Files storage mount.
16
-
17
-
> [!NOTE]
18
-
> The volume mounting features in Azure Container Apps are in preview.
15
+
Learn to write to permanent storage in a container app using an Azure Files storage mount. For more information about storage mounts, see [Use storage mounts in Azure Container Apps](storage-mounts.md).
@@ -17,12 +17,9 @@ A container app has access to different types of storage. A single app can take
17
17
| Storage type | Description | Usage examples |
18
18
|--|--|--|
19
19
|[Container file system](#container-file-system)| Temporary storage scoped to the local container | Writing a local app cache. |
20
-
|[Temporary storage](#temporary-storage)| Temporary storage scoped to an individual replica | Sharing files between containers in a replica. For instance, the main app container can write log files that are processed by a sidecar container. |
20
+
|[Ephemeral storage](#temporary-storage)| Temporary storage scoped to an individual replica | Sharing files between containers in a replica. For instance, the main app container can write log files that are processed by a sidecar container. |
21
21
|[Azure Files](#azure-files)| Permanent storage | Writing files to a file share to make data accessible by other systems. |
22
22
23
-
> [!NOTE]
24
-
> The volume mounting features in Azure Container Apps are in preview.
25
-
26
23
## Container file system
27
24
28
25
A container can write to its own file system.
@@ -33,19 +30,26 @@ Container file system storage has the following characteristics:
33
30
* Files written to this storage are only visible to processes running in the current container.
34
31
* There are no capacity guarantees. The available storage depends on the amount of disk space available in the container.
You can mount an ephemeralvolume that is equivalent to [emptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) in Kubernetes. Temporary storage is scoped to a single replica.
35
+
You can mount an ephemeral, temporary volume that is equivalent to [emptyDir](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) in Kubernetes. Ephemeral storage is scoped to a single replica.
39
36
40
-
Temporary storage has the following characteristics:
37
+
Ephemeral storage has the following characteristics:
41
38
42
39
* Files are persisted for the lifetime of the replica.
43
40
* If a container in a replica restarts, the files in the volume remain.
44
41
* Any containers in the replica can mount the same volume.
45
-
* A container can mount multiple temporary volumes.
46
-
* There are no capacity guarantees. The available storage depends on the amount of disk space available in the replica.
42
+
* A container can mount multiple ephemeral volumes.
43
+
* The available storage depends on the total amount of vCPUs allocated to the replica.
44
+
45
+
| vCPUs | Ephemeral storage |
46
+
|--|--|
47
+
| Up to 0.25 | 1 GiB |
48
+
| Up to 0.5 | 2 GiB |
49
+
| Up to 1 | 4 GiB |
50
+
| Over 1 | 8 GiB |
47
51
48
-
To configure temporary storage, first define an `EmptyDir` volume in the revision. Then define a volume mount in one or more containers in the revision.
52
+
To configure ephemeral storage, first define an `EmptyDir` volume in the revision. Then define a volume mount in one or more containers in the revision.
49
53
50
54
### Prerequisites
51
55
@@ -56,22 +60,22 @@ To configure temporary storage, first define an `EmptyDir` volume in the revisio
56
60
57
61
### Configuration
58
62
59
-
::: zone pivot="aca-cli"
63
+
::: zone pivot="azure-cli"
60
64
61
-
When using temporary storage, you must use the Azure CLI with a YAML definition to create or update your container app.
65
+
When configuring ephemeral storage using the Azure CLI, you must use a YAML definition to create or update your container app.
62
66
63
-
1. To update an existing container app to use temporary storage, export your app's specification to a YAML file named *app.yaml*.
67
+
1. To update an existing container app to use ephemeral storage, export your app's specification to a YAML file named *app.yaml*.
64
68
65
69
```azure-cli
66
70
az containerapp show -n <APP_NAME> -g <RESOURCE_GROUP_NAME> -o yaml > app.yaml
67
71
```
68
72
69
73
1. Make the following changes to your container app specification.
70
74
71
-
- Add a `volumes` array to the `template` section of your container app definition and define a volume.
75
+
- Add a `volumes` array to the `template` section of your container app definition and define a volume. If you already have a `volumes` array, add a new volume to the array.
72
76
- The `name` is an identifier for the volume.
73
77
- Use `EmptyDir` as the `storageType`.
74
-
- For each container in the template that you want to mount temporary storage, add a `volumeMounts` array to the container definition and define a volume mount.
78
+
- For each container in the template that you want to mount the ephemeral volume, define a volume mount in the `volumeMounts` array of the container definition.
75
79
- The `volumeName` is the name defined in the `volumes` array.
76
80
- The `mountPath` is the path in the container to mount the volume.
77
81
@@ -99,16 +103,18 @@ When using temporary storage, you must use the Azure CLI with a YAML definition
99
103
--yaml app.yaml
100
104
```
101
105
106
+
See the [YAML specification](azure-resource-manager-api-spec.md?tabs=yaml) for a full example.
107
+
102
108
::: zone-end
103
109
104
-
::: zone pivot="aca-arm"
110
+
::: zone pivot="azure-resource-manager"
105
111
106
-
To create a temporary volume and mount it in a container, make the following changes to the container apps resource in an ARM template:
112
+
To create an ephemeral volume and mount it in a container, make the following changes to the container apps resource in an ARM template:
107
113
108
-
- Add a `volumes` array to the `template` section of your container app definition and define a volume.
114
+
- Add a `volumes` array to the `template` section of your container app definition and define a volume. If you already have a `volumes` array, add a new volume to the array.
109
115
- The `name` is an identifier for the volume.
110
116
- Use `EmptyDir` as the `storageType`.
111
-
- For each container in the template that you want to mount temporary storage, add a `volumeMounts` array to the container definition and define a volume mount.
117
+
- For each container in the template that you want to mount temporary storage, define a volume mount in the `volumeMounts` array of the container definition.
112
118
- The `volumeName` is the name defined in the `volumes` array.
113
119
- The `mountPath` is the path in the container to mount the volume.
114
120
@@ -161,11 +167,35 @@ See the [ARM template API specification](azure-resource-manager-api-spec.md) for
161
167
162
168
::: zone-end
163
169
164
-
## Azure Files
165
170
166
-
You can mount a file share from [Azure Files](../storage/files/index.yml) as a volume inside a container.
171
+
::: zone pivot="azure-portal"
167
172
168
-
For a step-by-step tutorial, refer to [Create an Azure Files storage mount in Azure Container Apps](storage-mounts-azure-files.md).
173
+
To create an ephemeral volume and mount it in a container, deploy a new revision of your container app using the Azure portal.
174
+
175
+
1. In the Azure portal, navigate to your container app.
176
+
177
+
1. Select **Revision management** in the left menu.
178
+
179
+
1. Select **Create new revision**.
180
+
181
+
1. Select the container where you want to mount the volume.
182
+
183
+
1. In the *Edit a container* context pane, select the **Volume mounts** tab.
184
+
185
+
1. Under the *Ephemeral storage* section, create a new volume with the following information.
186
+
187
+
-**Volume name**: A name for the ephemeral volume.
188
+
-**Mount path**: The absolute path in the container to mount the volume.
189
+
190
+
1. Select **Save** to save changes and exit the context pane.
191
+
192
+
1. Select **Create** to create the new revision.
193
+
194
+
::: zone-end
195
+
196
+
## <aname="azure-files"></a>Azure Files volume
197
+
198
+
You can mount a file share from [Azure Files](../storage/files/index.yml) as a volume in a container.
169
199
170
200
Azure Files storage has the following characteristics:
171
201
@@ -177,8 +207,8 @@ Azure Files storage has the following characteristics:
177
207
178
208
To enable Azure Files storage in your container, you need to set up your container in the following ways:
179
209
180
-
* Create a storage definition of type `AzureFile`in the Container Apps environment.
181
-
* Define a storage volume in a revision.
210
+
* Create a storage definition in the Container Apps environment.
211
+
* Define a volume of type `AzureFile` in a revision.
182
212
* Define a volume mount in one or more containers in the revision.
183
213
184
214
#### Prerequisites
@@ -191,11 +221,13 @@ To enable Azure Files storage in your container, you need to set up your contain
191
221
192
222
### Configuration
193
223
194
-
::: zone pivot="aca-cli"
224
+
::: zone pivot="azure-cli"
195
225
196
-
When using Azure Files, you must use the Azure CLI with a YAML definition to create or update your container app.
226
+
When configuring a container app to mount an Azure Files volume using the Azure CLI, you must use a YAML definition to create or update your container app.
197
227
198
-
1. Add a storage definition of type `AzureFile` to your Container Apps environment.
228
+
For a step-by-step tutorial, refer to [Create an Azure Files storage mount in Azure Container Apps](storage-mounts-azure-files.md).
229
+
230
+
1. Add a storage definition to your Container Apps environment.
199
231
200
232
```azure-cli
201
233
az containerapp env storage set --name my-env --resource-group my-group \
@@ -218,11 +250,11 @@ When using Azure Files, you must use the Azure CLI with a YAML definition to cre
218
250
219
251
1. Make the following changes to your container app specification.
220
252
221
-
- Add a `volumes` array to the `template` section of your container app definition and define a volume.
253
+
- Add a `volumes` array to the `template` section of your container app definition and define a volume. If you already have a `volumes` array, add a new volume to the array.
222
254
- The `name` is an identifier for the volume.
223
255
- For `storageType`, use `AzureFile`.
224
256
- For `storageName`, use the name of the storage you defined in the environment.
225
-
- For each container in the template that you want to mount Azure Files storage, add a `volumeMounts` array to the container definition and define a volume mount.
257
+
- For each container in the template that you want to mount Azure Files storage, define a volume mount in the `volumeMounts` array of the container definition.
226
258
- The `volumeName` is the name defined in the `volumes` array.
227
259
- The `mountPath` is the path in the container to mount the volume.
228
260
@@ -250,9 +282,11 @@ When using Azure Files, you must use the Azure CLI with a YAML definition to cre
250
282
--yaml app.yaml
251
283
```
252
284
285
+
See the [YAML specification](azure-resource-manager-api-spec.md?tabs=yaml) for a full example.
286
+
253
287
::: zone-end
254
288
255
-
::: zone pivot="aca-arm"
289
+
::: zone pivot="azure-resource-manager"
256
290
257
291
The following ARM template snippets demonstrate how to add an Azure Files share to a Container Apps environment and use it in a container app.
258
292
@@ -341,14 +375,57 @@ The following ARM template snippets demonstrate how to add an Azure Files share
341
375
}
342
376
```
343
377
344
-
- Add a `volumes` array to the `template` section of your container app definition and define a volume.
378
+
- Add a `volumes` array to the `template` section of your container app definition and define a volume. If you already have a `volumes` array, add a new volume to the array.
345
379
- The `name` is an identifier for the volume.
346
380
- For `storageType`, use `AzureFile`.
347
381
- For `storageName`, use the name of the storage you defined in the environment.
348
-
- For each container in the template that you want to mount Azure Files storage, add a `volumeMounts` array to the container definition and define a volume mount.
382
+
- For each container in the template that you want to mount Azure Files storage, define a volume mount in the `volumeMounts` array of the container definition.
349
383
- The `volumeName` is the name defined in the `volumes` array.
350
384
- The `mountPath` is the path in the container to mount the volume.
351
385
352
386
See the [ARM template API specification](azure-resource-manager-api-spec.md) for a full example.
353
387
354
388
::: zone-end
389
+
390
+
::: zone pivot="azure-portal"
391
+
392
+
To configure a volume mount for Azure Files storage in the Azure portal, add a file share to your Container Apps environment and then add a volume mount to your container app by creating a new revision.
393
+
394
+
1. In the Azure portal, navigate to your Container Apps environment.
395
+
396
+
1. Select **Azure Files** from the left menu.
397
+
398
+
1. Select **Add**.
399
+
400
+
1. In the *Add file share* context menu, enter the following information:
401
+
402
+
- **Name**: A name for the file share.
403
+
- **Storage account name**: The name of the storage account that contains the file share.
404
+
- **Storage account key**: The access key for the storage account.
405
+
- **File share**: The name of the file share.
406
+
- **Access mode**: The access mode for the file share. Valid values are "Read/Write" and "Read only".
407
+
408
+
1. Select **Add** to exit the context pane.
409
+
410
+
1. Select **Save** to commit the changes.
411
+
412
+
1. Navigate to your container app.
413
+
414
+
1. Select **Revision management** from the left menu.
415
+
416
+
1. Select **Create new revision**.
417
+
418
+
1. Select the container that you want to mount the volume in.
419
+
420
+
1. In the *Edit a container* context pane, select the **Volume mounts** tab.
421
+
422
+
1. Under the *File shares* section, create a new volume with the following information.
423
+
424
+
- **File share name**: The file share you added.
425
+
- **Mount path**: The absolute path in the container to mount the volume.
426
+
427
+
1. Select **Save** to save changes and exit the context pane.
0 commit comments