7

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?

Rena-MSFT
  • 55
  • 4
Mathias Rönnlund
  • 4,078
  • 7
  • 43
  • 96

2 Answers2

1

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
Pang
  • 9,564
  • 146
  • 81
  • 122
  • what about the account key etc? There isn't enough info specified here to connect securely so how does that work - any tips? – Darrell May 04 '22 at 11:03
  • This answer is for container instance service, not app service I think. – lbris Aug 29 '22 at 20:15
0

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"

UPDATE:

These options are now deprecated, please follow instruction for CloudStor plugin at: https://docs.docker.com/docker-for-azure/persistent-data-volumes/

Nicola Ben
  • 10,615
  • 8
  • 41
  • 65