[英]How do I map an Azure File Share as a volume in a Docker Compose file?
I have so far only found examples on how to create a volume on the host machine, eg:到目前为止,我只找到了有关如何在主机上创建卷的示例,例如:
version: "3.3"
services:
mysql:
image: mysql
volumes:
- db-data:/var/lib/mysql/data
volumes:
db-data:
So this defines a volume named db-data that will physically be stored on the host machine running the container.因此,这定义了一个名为 db-data 的卷,该卷将物理存储在运行容器的主机上。
Is is possible to makes the db-data volume point to an Azure File Share in an Azure Storage account and how would I specify the needed parameters?是否可以使 db-data 卷指向 Azure 存储帐户中的 Azure 文件共享,我将如何指定所需的参数?
From CLI you can create with:从 CLI 您可以创建:
docker volume create -d azurefile -o share=myvol --name vol1
docker run -i -t -v vol1:/data busybox
In your compose you need to use this skeleton:在您的撰写中,您需要使用此骨架:
volumes:
myvol:
driver: azurefile
driver_opts:
accountname: ___your__account_name
accountkey: ___your_account_key
share: "volumes"
remotepath: "myvol"
UPDATE:更新:
These options are now deprecated, please follow instruction for CloudStor plugin at: https://docs.docker.com/docker-for-azure/persistent-data-volumes/这些选项现已弃用,请按照 CloudStor 插件的说明进行操作: https : //docs.docker.com/docker-for-azure/persistent-data-volumes/
The format that works for me currently is:目前对我有用的格式是:
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.