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
+20-55Lines changed: 20 additions & 55 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: 03/20/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,38 @@ 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
550
1. Change into the nginx */var/log/nginx* folder.
546
551
547
-
# [Bash](#tab/bash)
548
-
549
-
```bash
550
-
cd /var/log/nginx
551
-
```
552
-
553
-
# [PowerShell](#tab/powershell)
554
-
555
-
```powershell
552
+
```sh
556
553
cd /var/log/nginx
557
554
```
558
555
559
-
---
560
-
561
556
1. Return to the browser and navigate to the website and refresh the page a few times.
562
557
563
558
The requests made to the website create a series of log stream entries.
564
559
565
560
1. Return to your terminal and list the values of the `/var/log/nginx` folder.
566
561
567
-
# [Bash](#tab/bash)
568
-
569
-
```bash
562
+
```sh
570
563
ls
571
564
```
572
565
573
-
# [PowerShell](#tab/powershell)
574
-
575
-
```powershell
576
-
ls
577
-
```
578
-
579
-
---
580
-
581
566
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
567
583
568
1. View the contents of the *access.log* file.
584
569
585
-
# [Bash](#tab/bash)
586
-
587
-
```bash
570
+
```sh
588
571
cat access.log
589
572
```
590
573
591
-
# [PowerShell](#tab/powershell)
592
-
593
-
```powershell
594
-
type access.log
595
-
```
596
-
597
-
---
598
-
599
574
1. Exit out of the container's interactive shell to return to your local terminal session.
600
575
601
-
# [Bash](#tab/bash)
602
-
603
-
```bash
604
-
exit
605
-
```
606
-
607
-
# [PowerShell](#tab/powershell)
608
-
609
-
```powershell
576
+
```sh
610
577
exit
611
578
```
612
579
613
-
---
614
-
615
580
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
+30-4Lines changed: 30 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: 03/20/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,36 @@ 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
+
- **Mount path**: The path in the container where you want to mount the volume.
672
+
- **Sub path**: The path in the volume you want to mount.
673
+
674
+
The sub path is optional. If not specified, the volume root is mounted.
675
+
676
+
The sub path is 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. For example, `my-volume-folder` is a valid sub path, where `/my-volume-folder` is not.
677
+
678
+
The sub path can refer to either a folder or a file in the volume.
679
+
680
+
- If the sub path refers to a folder, the mount path should refer to an empty folder in the container.
681
+
682
+
- If the sub path refers to a file, the mount path should refer to a file that does not already exist in the container.
683
+
684
+
For example, suppose the sub path is `my-volume-folder/my-volume-file.txt`, and the mount path is `/my-container-folder/my-container-file`. The folder `/my-container-folder` should already exist in the container but should not yet contain the file `my-container-file.txt`.
685
+
686
+
Any sub path trailing slashes are ignored.
687
+
688
+
## Related content
689
+
690
+
- [Tutorial: Create an Azure Files volume mount in Azure Container Apps](storage-mounts-azure-files.md)
0 commit comments