How do I map an Azure File Share as a volume in a Docker Compose file?

Clash Royale CLAN TAG#URR8PPPHow 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, e.g:
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.
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?
1 Answer
1
From CLI you can create with:
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"
I added info to my answer
– Nicola Ben
Jun 23 at 5:58
In my scenario (Azure Web App for Containers) I cannot run anything, I can only upload a docker compose file. So can I create a volume using a docker compose file?
– MathiasR
Jun 25 at 8:59
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Yes, I know how to do it on the command line, but how do I create a volume in a docker compose file?
– MathiasR
Jun 21 at 13:01