Skip to content

Commit 2998970

Browse files
authored
Merge pull request #125940 from v-jaswel/aca/v-jaswel_work_item_371940_20250226
[ACA] [371940] Add subPath documentation.
2 parents 8aa58ec + c21eef5 commit 2998970

File tree

2 files changed

+50
-59
lines changed

2 files changed

+50
-59
lines changed

articles/container-apps/storage-mounts-azure-files.md

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: craigshoemaker
66
ms.service: azure-container-apps
77
ms.custom: devx-track-azurecli
88
ms.topic: tutorial
9-
ms.date: 02/03/2025
9+
ms.date: 03/20/2025
1010
ms.author: cshoe
1111
---
1212

@@ -438,30 +438,35 @@ Now you can update the container app configuration to support the storage mount.
438438
439439
1. Open *app.yaml* in a code editor.
440440
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:
442442
443443
```yml
444444
template:
445-
volumes:
446-
- name: my-azure-file-volume
447-
storageName: mystoragemount
448-
storageType: AzureFile
449445
containers:
450446
- image: nginx
447+
imageType: ContainerImage
451448
name: my-container-app
452-
volumeMounts:
453-
- volumeName: my-azure-file-volume
454-
mountPath: /var/log/nginx
455449
resources:
456450
cpu: 0.5
457-
ephemeralStorage: 3Gi
451+
ephemeralStorage: 2Gi
458452
memory: 1Gi
453+
volumeMounts:
454+
- volumeName: my-azure-file-volume
455+
mountPath: /var/log/nginx
459456
initContainers: null
460457
revisionSuffix: ''
461458
scale:
459+
cooldownPeriod: 300
462460
maxReplicas: 1
463461
minReplicas: 1
462+
pollingInterval: 30
464463
rules: null
464+
serviceBinds: null
465+
terminationGracePeriodSeconds: null
466+
volumes:
467+
- name: my-azure-file-volume
468+
storageName: mystoragemount
469+
storageType: AzureFile
465470
```
466471
467472
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
540545
541546
---
542547
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).
544549
545550
1. Change into the nginx */var/log/nginx* folder.
546551
547-
# [Bash](#tab/bash)
548-
549-
```bash
550-
cd /var/log/nginx
551-
```
552-
553-
# [PowerShell](#tab/powershell)
554-
555-
```powershell
552+
```sh
556553
cd /var/log/nginx
557554
```
558555
559-
---
560-
561556
1. Return to the browser and navigate to the website and refresh the page a few times.
562557
563558
The requests made to the website create a series of log stream entries.
564559
565560
1. Return to your terminal and list the values of the `/var/log/nginx` folder.
566561
567-
# [Bash](#tab/bash)
568-
569-
```bash
562+
```sh
570563
ls
571564
```
572565
573-
# [PowerShell](#tab/powershell)
574-
575-
```powershell
576-
ls
577-
```
578-
579-
---
580-
581566
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.
582567
583568
1. View the contents of the *access.log* file.
584569
585-
# [Bash](#tab/bash)
586-
587-
```bash
570+
```sh
588571
cat access.log
589572
```
590573
591-
# [PowerShell](#tab/powershell)
592-
593-
```powershell
594-
type access.log
595-
```
596-
597-
---
598-
599574
1. Exit out of the container's interactive shell to return to your local terminal session.
600575
601-
# [Bash](#tab/bash)
602-
603-
```bash
604-
exit
605-
```
606-
607-
# [PowerShell](#tab/powershell)
608-
609-
```powershell
576+
```sh
610577
exit
611578
```
612579
613-
---
614-
615580
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.
616581
617582
# [Bash](#tab/bash)

articles/container-apps/storage-mounts.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: craigshoemaker
66
ms.service: azure-container-apps
77
ms.custom: devx-track-azurecli
88
ms.topic: conceptual
9-
ms.date: 02/25/2025
9+
ms.date: 03/20/2025
1010
ms.author: cshoe
1111
zone_pivot_groups: arm-azure-cli-portal
1212
---
@@ -326,7 +326,7 @@ For a step-by-step tutorial on mounting an SMB file share, refer to [Create an A
326326
- 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.
327327
- The `volumeName` is the name defined in the `volumes` array.
328328
- 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).
330330
331331
# [SMB](#tab/smb)
332332
@@ -586,7 +586,7 @@ The following ARM template snippets demonstrate how to add an Azure Files share
586586
- 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.
587587
- The `volumeName` is the name defined in the `volumes` array.
588588
- 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).
590590
591591
See the [ARM template API specification](azure-resource-manager-api-spec.md) for a full example.
592592
@@ -656,10 +656,36 @@ To configure a volume mount for Azure Files storage in the Azure portal, add a f
656656
657657
1. In **Mount path**, enter the absolute path in the container to mount the volume.
658658
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).
660660
661661
1. Select **Save** to save changes and exit the context pane.
662662
663663
1. Select **Create** to create the new revision.
664664
665665
::: 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)
691+
- [Using subPath](https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath)

0 commit comments

Comments
 (0)