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
+29-52Lines changed: 29 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ author: craigshoemaker
6
6
ms.service: azure-container-apps
7
7
ms.custom: devx-track-azurecli
8
8
ms.topic: tutorial
9
-
ms.date: 02/03/2025
9
+
ms.date: 02/26/2025
10
10
ms.author: cshoe
11
11
---
12
12
@@ -438,30 +438,35 @@ Now you can update the container app configuration to support the storage mount.
438
438
439
439
1. Open *app.yaml* in a code editor.
440
440
441
-
1. Replace the `volumes: null` definition in the `template` section with a `volumes:` definition referencing the storage volume. The template section should look like the following:
441
+
1. Replace the `volumes: null` definition in the `template` section with a `volumes:` definition referencing the storage volume. The template section should look like the following:
442
442
443
443
```yml
444
444
template:
445
-
volumes:
446
-
- name: my-azure-file-volume
447
-
storageName: mystoragemount
448
-
storageType: AzureFile
449
445
containers:
450
446
- image: nginx
447
+
imageType: ContainerImage
451
448
name: my-container-app
452
-
volumeMounts:
453
-
- volumeName: my-azure-file-volume
454
-
mountPath: /var/log/nginx
455
449
resources:
456
450
cpu: 0.5
457
-
ephemeralStorage: 3Gi
451
+
ephemeralStorage: 2Gi
458
452
memory: 1Gi
453
+
volumeMounts:
454
+
- volumeName: my-azure-file-volume
455
+
mountPath: /var/log/nginx
459
456
initContainers: null
460
457
revisionSuffix: ''
461
458
scale:
459
+
cooldownPeriod: 300
462
460
maxReplicas: 1
463
461
minReplicas: 1
462
+
pollingInterval: 30
464
463
rules: null
464
+
serviceBinds: null
465
+
terminationGracePeriodSeconds: null
466
+
volumes:
467
+
- name: my-azure-file-volume
468
+
storageName: mystoragemount
469
+
storageType: AzureFile
465
470
```
466
471
467
472
The new `template.volumes` section includes the following properties.
@@ -540,78 +545,50 @@ Now that the storage mount is established, you can manipulate files in Azure Sto
540
545
541
546
---
542
547
543
-
This command may take a moment to open the remote shell. Once the shell is ready, you can interact with the storage mount via file system commands.
548
+
This command may take a moment to open the remote shell. Once the shell is ready, you can interact with the storage mount via file system commands. For more information see [Connect to a container console in Azure Container Apps](/azure/container-apps/container-console).
544
549
545
-
1. Change into the nginx */var/log/nginx* folder.
550
+
1. Run the following command to see the mounted file share.
1. Return to the browser and navigate to the website and refresh the page a few times.
562
569
563
570
The requests made to the website create a series of log stream entries.
564
571
565
572
1. Return to your terminal and list the values of the `/var/log/nginx` folder.
566
573
567
-
# [Bash](#tab/bash)
568
-
569
-
```bash
574
+
```sh
570
575
ls
571
576
```
572
577
573
-
# [PowerShell](#tab/powershell)
574
-
575
-
```powershell
576
-
ls
577
-
```
578
-
579
-
---
580
-
581
578
Note how the *access.log* and *error.log* files appear in this folder. These files are written to the Azure Files mount in your Azure Storage share created in the previous steps.
582
579
583
580
1. View the contents of the *access.log* file.
584
581
585
-
# [Bash](#tab/bash)
586
-
587
-
```bash
582
+
```sh
588
583
cat access.log
589
584
```
590
585
591
-
# [PowerShell](#tab/powershell)
592
-
593
-
```powershell
594
-
type access.log
595
-
```
596
-
597
-
---
598
-
599
586
1. Exit out of the container's interactive shell to return to your local terminal session.
600
587
601
-
# [Bash](#tab/bash)
602
-
603
-
```bash
604
-
exit
605
-
```
606
-
607
-
# [PowerShell](#tab/powershell)
608
-
609
-
```powershell
588
+
```sh
610
589
exit
611
590
```
612
591
613
-
---
614
-
615
592
1. Now, you can view the files in the Azure portal to verify they exist in your Azure Storage account. Print the name of your randomly generated storage account.
Copy file name to clipboardExpand all lines: articles/container-apps/storage-mounts.md
+19-4Lines changed: 19 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ author: craigshoemaker
6
6
ms.service: azure-container-apps
7
7
ms.custom: devx-track-azurecli
8
8
ms.topic: conceptual
9
-
ms.date: 02/25/2025
9
+
ms.date: 02/26/2025
10
10
ms.author: cshoe
11
11
zone_pivot_groups: arm-azure-cli-portal
12
12
---
@@ -326,7 +326,7 @@ For a step-by-step tutorial on mounting an SMB file share, refer to [Create an A
326
326
- 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.
327
327
- The `volumeName` is the name defined in the `volumes` array.
328
328
- The `mountPath` is the path in the container to mount the volume.
329
-
- The `subPath` (optional) is the path in the volume to mount. If not specified, the volume root is mounted. For more information see [using subPath](https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath).
329
+
- The `subPath` is the path in the volume to mount. If not specified, the volume root is mounted. For more information see (#sub-path).
330
330
331
331
# [SMB](#tab/smb)
332
332
@@ -586,7 +586,7 @@ The following ARM template snippets demonstrate how to add an Azure Files share
586
586
- 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.
587
587
- The `volumeName` is the name defined in the `volumes` array.
588
588
- The `mountPath` is the path in the container to mount the volume.
589
-
- The `subPath` (optional) is the path in the volume to mount. If not specified, the volume root is mounted. For more information see [using subPath](https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath).
589
+
- The `subPath` (optional) is the path in the volume to mount. If not specified, the volume root is mounted. For more information see (#sub-path).
590
590
591
591
See the [ARM template API specification](azure-resource-manager-api-spec.md) for a full example.
592
592
@@ -656,10 +656,25 @@ To configure a volume mount for Azure Files storage in the Azure portal, add a f
656
656
657
657
1. In **Mount path**, enter the absolute path in the container to mount the volume.
658
658
659
-
1. In **Sub path (optional)**, enter the path in the volume to mount. If not specified, the volume root is mounted. For more information see [using subPath](https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath).
659
+
1. In **Sub path (optional)**, enter the path in the volume to mount. If not specified, the volume root is mounted. For more information see (#sub-path).
660
660
661
661
1. Select **Save** to save changes and exit the context pane.
662
662
663
663
1. Select **Create** to create the new revision.
664
664
665
665
::: zone-end
666
+
667
+
### Sub path
668
+
669
+
When mounting a file share from Azure Files, in addition to the mount path, you can also specify a sub path.
670
+
671
+
- The mount path is the path in the container where you want to mount the volume.
672
+
- The sub path is the path in the volume you want to mount.
673
+
- The sub path is optional. If not specified, the volume root is mounted.
674
+
- The sub path should be a relative path from the volume root. The sub path should not start with `/`. Specifying a sub path that starts with `/` might prevent your container app from starting up.
675
+
- The sub path can refer to either a folder or a file in the volume.
676
+
- If the sub path refers to a folder in the volume, the mount path should refer to an empty folder in the container.
677
+
- If the sub path refers to a file in the volume, the mount path should refer to a file that does not exist in the container. For example, if the sub path is `my-volume-folder/my-volume-file`, and the mount path is `/my-container-folder/my-container-file`, the folder `/my-container-folder` should exist in the container, but should not already contain the file `my-container-file`.
678
+
- If the sub path contains a trailing `/`, whether it refers to a folder or file, the trailing `/` is ignored.
679
+
680
+
For more information see [using subPath](https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath).
0 commit comments