mirror of https://github.com/docker/docs.git
Add documentation for ACI volume management commands (#11362)
* Add documentation for ACI volume management commands Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com> * Style and formatting updates * Minor style update Co-authored-by: Usha Mandya <47779042+usha-mandya@users.noreply.github.com>
This commit is contained in:
parent
9a49bb310e
commit
48824ab98c
|
@ -155,14 +155,17 @@ You can also deploy and manage multi-container applications defined in Compose f
|
||||||
|
|
||||||
You can deploy containers or Compose applications that use persistent data
|
You can deploy containers or Compose applications that use persistent data
|
||||||
stored in volumes. Azure File Share can be used to support volumes for ACI
|
stored in volumes. Azure File Share can be used to support volumes for ACI
|
||||||
containers.
|
containers.
|
||||||
|
|
||||||
With an existing Azure File Share, with storage account name `mystorageaccount`
|
Using an existing Azure File Share with storage account name `mystorageaccount`
|
||||||
and file share name `myfileshare`, you can specify a volume in your deployment `run`
|
and file share name `myfileshare`, you can specify a volume in your deployment `run`
|
||||||
command as follows:
|
command as follows:
|
||||||
|
|
||||||
`docker run -v storageaccount@fileshare:/target/path myimage` and the runtime
|
```
|
||||||
container will see the file share content in `/target/path`.
|
docker run -v storageaccount/fileshare:/target/path myimage
|
||||||
|
```
|
||||||
|
|
||||||
|
The runtime container will see the file share content in `/target/path`.
|
||||||
|
|
||||||
In a Compose application, the volume specification must use the following syntax
|
In a Compose application, the volume specification must use the following syntax
|
||||||
in the Compose file:
|
in the Compose file:
|
||||||
|
@ -181,11 +184,66 @@ volumes:
|
||||||
storage_account_name: mystorageaccount
|
storage_account_name: mystorageaccount
|
||||||
```
|
```
|
||||||
|
|
||||||
Now, you need to create an Azure storage account and File Share using the Azure
|
When you deploy a single container or a Compose application, your
|
||||||
|
Azure login automatically fetches the key to the Azure storage account.
|
||||||
|
|
||||||
|
### Managing Azure volumes
|
||||||
|
|
||||||
|
To create a volume that you can use in containers or Compose applications when
|
||||||
|
using your ACI Docker context, you can use the `docker volume create` command,
|
||||||
|
and specify an Azure storage account name and the file share name:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker --context aci volume create --storage-account mystorageaccount --fileshare test-volume
|
||||||
|
[+] Running 2/2
|
||||||
|
⠿ mystorageaccount Created 26.2s
|
||||||
|
⠿ test-volume Created 0.9s
|
||||||
|
mystorageaccount/test-volume
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, if the storage account does not already exist, this command
|
||||||
|
creates a new storage account using the Standard LRS as a default SKU, and the
|
||||||
|
resource group and location associated with you Docker ACI context.
|
||||||
|
|
||||||
|
If you specify an existing storage account, the command creates a new
|
||||||
|
file share in the exsting account:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker --context aci volume create --storage-account mystorageaccount --fileshare test-volume2
|
||||||
|
[+] Running 2/2
|
||||||
|
⠿ mystorageaccount Use existing 0.7s
|
||||||
|
⠿ test-volume2 Created 0.7s
|
||||||
|
mystorageaccount/test-volume2
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can create an Azure storage account or a file share using the Azure
|
||||||
portal, or the `az` [command line](https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-cli).
|
portal, or the `az` [command line](https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-cli).
|
||||||
|
|
||||||
When you deploy a single container or a Compose application, your
|
You can also list volumes that are available for use in containers or Compose applications:
|
||||||
Azure login will automatically fetch the key to the Azure storage account.
|
|
||||||
|
```
|
||||||
|
$ docker --context aci volume ls
|
||||||
|
ID DESCRIPTION
|
||||||
|
mystorageaccount/test-volume Fileshare test-volume in mystorageaccount storage account
|
||||||
|
mystorageaccount/test-volume2 Fileshare test-volume2 in mystorageaccount storage account
|
||||||
|
```
|
||||||
|
|
||||||
|
To delete a volume and the corresponding Azure file share, use the `volume rm` command:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker --context aci volume rm mystorageaccount/test-volume
|
||||||
|
mystorageaccount/test-volume
|
||||||
|
```
|
||||||
|
|
||||||
|
This permanently deletes the Azure file share and all its data.
|
||||||
|
|
||||||
|
When deleting a volume in Azure, the command checks whether the specified file share
|
||||||
|
is the only file share available in the storage account. If the storage account is
|
||||||
|
created with the `docker volume create` command, `docker volume rm` also
|
||||||
|
deletes the storage account when it does not have any file shares.
|
||||||
|
If you are using a storage account created without the `docker volume create` command
|
||||||
|
(through Azure portal or with the `az` command line for example), `docker volume rm`
|
||||||
|
does not delete the storage account, even when it has zero remaining file shares.
|
||||||
|
|
||||||
## Using ACI resource groups as namespaces
|
## Using ACI resource groups as namespaces
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue