Skip to content

Commit 8f8bc16

Browse files
committed
[ACA] [371940] Add subPath documentation.
1 parent d8f9176 commit 8f8bc16

File tree

2 files changed

+48
-56
lines changed

2 files changed

+48
-56
lines changed

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

Lines changed: 29 additions & 52 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: 02/26/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,50 @@ 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
545-
1. Change into the nginx */var/log/nginx* folder.
550+
1. Run the following command to see the mounted file share.
546551
547-
# [Bash](#tab/bash)
552+
```sh
553+
findmnt | grep nginx
554+
```
548555
549-
```bash
550-
cd /var/log/nginx
556+
You see output similar to the following.
557+
558+
```
559+
`-/var/log/nginx //<STORAGE_ACCOUNT_NAME>.file.core.windows.net/<STORAGE_SHARE_NAME> cifs rw,relatime,vers=3.1.1,cache=strict,username=<STORAGE_ACCOUNT_NAME>,uid=0,forceuid,gid=0,forcegid,addr=57.150.154.70,file_mode=0777,dir_mode=0777,soft,persistenthandles,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=30,actimeo=1,closetimeo=1
551560
```
552561
553-
# [PowerShell](#tab/powershell)
562+
1. Change into the nginx */var/log/nginx* folder.
554563
555-
```powershell
564+
```sh
556565
cd /var/log/nginx
557566
```
558567
559-
---
560-
561568
1. Return to the browser and navigate to the website and refresh the page a few times.
562569
563570
The requests made to the website create a series of log stream entries.
564571
565572
1. Return to your terminal and list the values of the `/var/log/nginx` folder.
566573
567-
# [Bash](#tab/bash)
568-
569-
```bash
574+
```sh
570575
ls
571576
```
572577
573-
# [PowerShell](#tab/powershell)
574-
575-
```powershell
576-
ls
577-
```
578-
579-
---
580-
581578
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.
582579
583580
1. View the contents of the *access.log* file.
584581
585-
# [Bash](#tab/bash)
586-
587-
```bash
582+
```sh
588583
cat access.log
589584
```
590585
591-
# [PowerShell](#tab/powershell)
592-
593-
```powershell
594-
type access.log
595-
```
596-
597-
---
598-
599586
1. Exit out of the container's interactive shell to return to your local terminal session.
600587
601-
# [Bash](#tab/bash)
602-
603-
```bash
604-
exit
605-
```
606-
607-
# [PowerShell](#tab/powershell)
608-
609-
```powershell
588+
```sh
610589
exit
611590
```
612591
613-
---
614-
615592
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.
616593
617594
# [Bash](#tab/bash)

articles/container-apps/storage-mounts.md

Lines changed: 19 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: 02/26/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,25 @@ 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+
- 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

Comments
 (0)