@@ -155,14 +155,17 @@ You can also deploy and manage multi-container applications defined in Compose f
155
155
156
156
You can deploy containers or Compose applications that use persistent data
157
157
stored in volumes. Azure File Share can be used to support volumes for ACI
158
- containers.
158
+ containers.
159
159
160
- With an existing Azure File Share, with storage account name ` mystorageaccount `
160
+ Using an existing Azure File Share with storage account name ` mystorageaccount `
161
161
and file share name ` myfileshare ` , you can specify a volume in your deployment ` run `
162
162
command as follows:
163
163
164
- ` docker run -v storageaccount@fileshare:/target/path myimage ` and the runtime
165
- container will see the file share content in ` /target/path ` .
164
+ ```
165
+ docker run -v storageaccount/fileshare:/target/path myimage
166
+ ```
167
+
168
+ The runtime container will see the file share content in ` /target/path ` .
166
169
167
170
In a Compose application, the volume specification must use the following syntax
168
171
in the Compose file:
@@ -181,11 +184,66 @@ volumes:
181
184
storage_account_name : mystorageaccount
182
185
` ` `
183
186
184
- Now, you need to create an Azure storage account and File Share using the Azure
187
+ When you deploy a single container or a Compose application, your
188
+ Azure login automatically fetches the key to the Azure storage account.
189
+
190
+ ### Managing Azure volumes
191
+
192
+ To create a volume that you can use in containers or Compose applications when
193
+ using your ACI Docker context, you can use the ` docker volume create` command,
194
+ and specify an Azure storage account name and the file share name :
195
+
196
+ ` ` `
197
+ $ docker --context aci volume create --storage-account mystorageaccount --fileshare test-volume
198
+ [+] Running 2/2
199
+ ⠿ mystorageaccount Created 26.2s
200
+ ⠿ test-volume Created 0.9s
201
+ mystorageaccount/test-volume
202
+ ` ` `
203
+
204
+ By default, if the storage account does not already exist, this command
205
+ creates a new storage account using the Standard LRS as a default SKU, and the
206
+ resource group and location associated with you Docker ACI context.
207
+
208
+ If you specify an existing storage account, the command creates a new
209
+ file share in the exsting account :
210
+
211
+ ` ` `
212
+ $ docker --context aci volume create --storage-account mystorageaccount --fileshare test-volume2
213
+ [+] Running 2/2
214
+ ⠿ mystorageaccount Use existing 0.7s
215
+ ⠿ test-volume2 Created 0.7s
216
+ mystorageaccount/test-volume2
217
+ ` ` `
218
+
219
+ Alternatively, you can create an Azure storage account or a file share using the Azure
185
220
portal, or the `az` [command line](https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-cli).
186
221
187
- When you deploy a single container or a Compose application, your
188
- Azure login will automatically fetch the key to the Azure storage account.
222
+ You can also list volumes that are available for use in containers or Compose applications :
223
+
224
+ ` ` `
225
+ $ docker --context aci volume ls
226
+ ID DESCRIPTION
227
+ mystorageaccount/test-volume Fileshare test-volume in mystorageaccount storage account
228
+ mystorageaccount/test-volume2 Fileshare test-volume2 in mystorageaccount storage account
229
+ ` ` `
230
+
231
+ To delete a volume and the corresponding Azure file share, use the `volume rm` command :
232
+
233
+ ` ` `
234
+ $ docker --context aci volume rm mystorageaccount/test-volume
235
+ mystorageaccount/test-volume
236
+ ` ` `
237
+
238
+ This permanently deletes the Azure file share and all its data.
239
+
240
+ When deleting a volume in Azure, the command checks whether the specified file share
241
+ is the only file share available in the storage account. If the storage account is
242
+ created with the `docker volume create` command, `docker volume rm` also
243
+ deletes the storage account when it does not have any file shares.
244
+ If you are using a storage account created without the `docker volume create` command
245
+ (through Azure portal or with the `az` command line for example), `docker volume rm`
246
+ does not delete the storage account, even when it has zero remaining file shares.
189
247
190
248
# # Using ACI resource groups as namespaces
191
249
0 commit comments