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-instances/container-instances-volume-secret.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,22 @@
2
2
title: Mount secret volume to container group
3
3
description: Learn how to mount a secret volume to store sensitive information for access by your container instances
4
4
ms.topic: article
5
-
ms.date: 07/19/2018
5
+
ms.date: 04/03/2020
6
6
---
7
7
8
8
# Mount a secret volume in Azure Container Instances
9
9
10
10
Use a *secret* volume to supply sensitive information to the containers in a container group. The *secret* volume stores your secrets in files within the volume, accessible by the containers in the container group. By storing secrets in a *secret* volume, you can avoid adding sensitive data like SSH keys or database credentials to your application code.
11
11
12
-
All *secret* volumes are backed by [tmpfs][tmpfs], a RAM-backed filesystem; their contents are never written to non-volatile storage.
12
+
* Once deployed with secrets in a container group, a secret volume is *read-only*.
13
+
* All secret volumes are backed by [tmpfs][tmpfs], a RAM-backed filesystem; their contents are never written to non-volatile storage.
13
14
14
15
> [!NOTE]
15
16
> *Secret* volumes are currently restricted to Linux containers. Learn how to pass secure environment variables for both Windows and Linux containers in [Set environment variables](container-instances-environment-variables.md). While we're working to bring all features to Windows containers, you can find current platform differences in the [overview](container-instances-overview.md#linux-and-windows-containers).
16
17
17
18
## Mount secret volume - Azure CLI
18
19
19
-
To deploy a container with one or more secrets by using the Azure CLI, include the `--secrets` and `--secrets-mount-path` parameters in the [az container create][az-container-create] command. This example mounts a *secret* volume consisting of two secrets, "mysecret1" and "mysecret2," at `/mnt/secrets`:
20
+
To deploy a container with one or more secrets by using the Azure CLI, include the `--secrets` and `--secrets-mount-path` parameters in the [az container create][az-container-create] command. This example mounts a *secret* volume consisting of two files containing secrets, "mysecret1" and "mysecret2," at `/mnt/secrets`:
20
21
21
22
```azurecli-interactive
22
23
az container create \
@@ -30,11 +31,13 @@ az container create \
30
31
The following [az container exec][az-container-exec] output shows opening a shell in the running container, listing the files within the secret volume, then displaying their contents:
31
32
32
33
```azurecli
33
-
az container exec --resource-group myResourceGroup --name secret-volume-demo --exec-command "/bin/sh"
@@ -51,7 +54,7 @@ You can also deploy container groups with the Azure CLI and a [YAML template](co
51
54
52
55
When you deploy with a YAML template, the secret values must be **Base64-encoded** in the template. However, the secret values appear in plaintext within the files in the container.
53
56
54
-
The following YAML template defines a container group with one container that mounts a *secret* volume at `/mnt/secrets`. The secret volume has two secrets, "mysecret1" and "mysecret2."
57
+
The following YAML template defines a container group with one container that mounts a *secret* volume at `/mnt/secrets`. The secret volume has two files containing secrets, "mysecret1" and "mysecret2."
55
58
56
59
```yaml
57
60
apiVersion: '2018-10-01'
@@ -86,7 +89,9 @@ To deploy with the YAML template, save the preceding YAML to a file named `deplo
86
89
87
90
```azurecli-interactive
88
91
# Deploy with YAML template
89
-
az container create --resource-group myResourceGroup --file deploy-aci.yaml
92
+
az container create \
93
+
--resource-group myResourceGroup \
94
+
--file deploy-aci.yaml
90
95
```
91
96
92
97
## Mount secret volume - Resource Manager
@@ -102,11 +107,13 @@ The following Resource Manager template defines a container group with one conta
To deploy with the Resource Manager template, save the preceding JSON to a file named `deploy-aci.json`, then execute the [az group deployment create][az-group-deployment-create] command with the `--template-file` parameter:
110
+
To deploy with the Resource Manager template, save the preceding JSON to a file named `deploy-aci.json`, then execute the [az deployment group create][az-deployment-group-create] command with the `--template-file` parameter:
106
111
107
112
```azurecli-interactive
108
113
# Deploy with Resource Manager template
109
-
az group deployment create --resource-group myResourceGroup --template-file deploy-aci.json
114
+
az deployment group create \
115
+
--resource-group myResourceGroup \
116
+
--template-file deploy-aci.json
110
117
```
111
118
112
119
## Next steps
@@ -129,4 +136,4 @@ Another method for providing sensitive information to containers (including Wind
0 commit comments