question

JasonZhang-4231 avatar image
0 Votes"
JasonZhang-4231 asked JasonZhang-4231 commented

Can I user docker create volume in multicontainer instances of webapp and why

I have a multi containers webapp deployed with mariadb container, I trying to mount with azure file share but it not work due to directory permission, Can I user docker create volume instead? I test stop start webapp, volume still there, will there be any problem? I couldnt find any explanation, anyone can answer here?
in docker compose file as follow:
version: '3.4'
volumes:
acl-database-data: {}

azure-webappsazure-files
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered JasonZhang-4231 commented

The short answer @JasonZhang-4231 is yes. When you create the mount acl-database-data in your docker compose, you need to have an Azure File Share mount with that same name, similar to the image down below.

109455557-edaecf80-7a24-11eb-804d-438531f3388e.png

You can find the documentation over on https://docs.microsoft.com/en-us/azure/app-service/configure-connect-to-azure-storage?pivots=container-linux.

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for answer,
if I create storage mapping, my database has no proper permission to access mounted directory which is a big issue.
and the strange thing is it works for without mapping azure storage mount and after webapp stop and start, the volume not lost,
could you explain what happened? I couldnt find any material why this works and if there any problem in future

I create volume in docker compose as below:

 version: '3.4'
 volumes:
   acl-database-data: {}
 services:
   acl_database:
     image: mariadb:latest
     container_name: acl_database
     environment:
       MYSQL_ROOT_PASSWORD: 
       MYSQL_DATABASE: 
       MYSQL_USER: 
       MYSQL_PASSWORD: 
     volumes:
       - acl-database-data:/var/lib/mysql/
     restart: always



0 Votes 0 ·

This isn't a supported workflow @JasonZhang-4231 due to the permissions on the CIFS volumes that underlies the storage mount. It's recommended you connect your app to cloud database, in your case it would be a MariaDb instance

1 Vote 1 ·

Thanks for answering, and this is the bit I get confused, after deploy previous docker-compose file, with start, stop and update app Service, all data in database still exist, why is it? what risk am I facing?

0 Votes 0 ·
Show more comments