互联网技术 / 互联网资讯 · 2024年1月23日

使用ACI Docker管理Azure卷的云计算核心技术Docker教程

若要在使用 ACI Docker 上下文时创建可在容器或Compose应用程序中使用的卷,可以使用该docker volume create命令,并指定Azure存储帐户名称和文件共享名称:

$ docker volume create test-volume –storage-account MYstorageaccount

[+] Running 2/2

MYstorageaccount Created 26.2s

test-volume Created 0.9s

MYstorageaccount/test-volume

默认情况下,如果存储帐户尚不存在,此命令将使用标准LRS作为默认SKU以及与Docker ACI上下文关联的资源组和位置创建一个新的存储帐户。

如果指定现有存储帐户,该命令将在现有帐户中创建新的文件共享:

$ docker volume create test-volume2 –storage-account MYstorageaccount

[+] Running 2/2

MYstorageaccount use existing 0.7s

test-volume2 Created 0.7s

MYstorageaccount/test-volume2

或者,您可以使用Azure门户或az命令行创建Azure存储帐户或文件共享。

您还可以列出可用于容器或Compose应用程序的卷:

$ docker volume ls

ID DESCRIPTION

MYstorageaccount/test-volume fileshare test-volume in MYstorageaccount storage account

MYstorageaccount/test-volume2 fileshare test-volume2 in MYstorageaccount storage account

要删除卷和相应的Azure文件共享,请使用以下volume RM命令:

$ docker volume RM MYstorageaccount/test-volume

MYstorageaccount/test-volume

这将永久删除Azure文件共享及其所有数据。

在Azure中删除卷时,该命令会检查指定的文件共享是否是存储帐户中唯一可用的文件共享。如果存储帐户是使用该docker volume create命令创建的,则docker volume RM当它没有任何文件共享时也会删除该存储帐户。如果使用未通过docker volume create命令创建的存储帐户(例如通过Azure门户或使用az命令行),docker volume RM则不会删除该存储帐户,即使它的剩余文件共享为零。

OpenMagic API

Need more than content? Move into the product flow.

If you are here for model access, pricing, developer docs, or the future API console, the dedicated product path now lives on api.openmagic.ai.