Deploy multiple container instances with volume using docker-compose

Babak N 1 Reputation point
2021-12-21T23:50:12.483+00:00

It is not clear how to add volume (from Azure storage) to the docker-compose.yml file .

I have followed the description on how to create Azure file share and mount it. However it is missing how to do that with docker-compose.
I came a cross with a solution like this one (when there are multiple volumes needed):

volumes:
  data:
      driver: azure_file
      driver_opts:
          share_name: hitapp-volumn
          storage_account_name: hitappserverst
  front_vol:
      driver: azure_file
      driver_opts:
          share_name: hitapp-frontend
          storage_account_name: hitappserverst

But when building the images using "docker-compose up --build -d", I get an error for "azure_file" plugin:

"Error response from daemon: create hitapp_server_front_vol: error looking up volume plugin azure_file: plugin "azure_file" not found"

I also see that the azure_file plugin in github is deprecated: https://github.com/Azure/azurefile-dockervolumedriver

What should I use now? How can I use couple of volumes in docker-compose?

thanks!

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
460 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Manu Philip 14,061 Reputation points Microsoft MVP
    2021-12-22T10:50:08.45+00:00

    I suggest to try mounting the volumes in the following way:

    services:
       web:
         image: acrcontainer/tomcat
         ports:
           - "8080:8080"
         volumes:
           - hitappserverst: /home/hitapp-volumn
           - hitappserverst: /home/hitappserverst
    volume:
         - hitappserverst
    File share name: hitappserverst
    

    The name of the storage mount would be hitappserverst and the mount path the folder insider your container /home/hitapp-volumn


    If the Answer is helpful, please click "Accept Answer" and upvote it