![](/img/trans.png)
[英]How to mount Azure File Share as Volume for Container Group using docker-compose?
[英]How do I map an Azure File Share as a volume in a Docker Compose file?
到目前為止,我只找到了有關如何在主機上創建卷的示例,例如:
version: "3.3"
services:
mysql:
image: mysql
volumes:
- db-data:/var/lib/mysql/data
volumes:
db-data:
因此,這定義了一個名為 db-data 的卷,該卷將物理存儲在運行容器的主機上。
是否可以使 db-data 卷指向 Azure 存儲帳戶中的 Azure 文件共享,我將如何指定所需的參數?
從 CLI 您可以創建:
docker volume create -d azurefile -o share=myvol --name vol1
docker run -i -t -v vol1:/data busybox
在您的撰寫中,您需要使用此骨架:
volumes:
myvol:
driver: azurefile
driver_opts:
accountname: ___your__account_name
accountkey: ___your_account_key
share: "volumes"
remotepath: "myvol"
更新:
這些選項現已棄用,請按照 CloudStor 插件的說明進行操作: https : //docs.docker.com/docker-for-azure/persistent-data-volumes/
目前對我有用的格式是:
version: "3.8"
volumes:
db-data:
driver: azure_file
driver_opts:
share_name: myfileshare
storage_account_name: mystorageaccount
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.