question

TomohiroH-2774 avatar image
0 Votes"
TomohiroH-2774 asked azure-cxp-api edited

How to use persistent storage with Web Apps by docker-compose?

If you have any advices, please give me!

I tried to use persistent storage following this article (https://docs.microsoft.com/en-US/azure/app-service/containers/tutorial-multi-container-app), but couldn't use...It start initialize after stop the service few days.

At local, I wrote docker-compose.yml below.

 services:
   testdb:
     volumes:
       - testdb_data:/test
 …
    
   testapps:
     volumes:
       - testapps_data:/test
 …
    
 volumes:
   testdb_data:
     driver: local
   testapps_data:
     driver: local

And At Web Apps, I changed like this. This work well without persistent storage.

 services:
   testdb:
     volumes:
       - testdb_data:/test
 …
    
   testapp:
     volumes:
       - testapp_data:/test
 …
    
 volumes:
   testdb_data:
     driver: local
     driver_opts:
       device: ${WEBAPP_STORAGE_HOME}
   testapp_data:
     driver: local
     driver_opts:
       device: ${WEBAPP_STORAGE_HOME}


I can see the "WEBSITES_ENABLE_APP_SERVICE_STORAGE=TRUE " in log-stream, so the option is active to use persistent storage...

Thank you.

azure-webapps
· 1
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.

Hi TomohiroH-2774 ,


Are you getting any specific errors?

The /home in your app is provided to enable your container app to access persistent storage.

try mounting the shared storage to path. mount-path [path to mount storage volume within the container].

Example:

volumes:

${WEBAPP_STORAGE_HOME}/site/wwwroot:/var/www/html

(WEBAPP_STORAGE_HOME ) is an alias used to reference the app service storage. App Service Storage has precreated LogFiles and site folders, with a wwwroot folder under the site.


0 Votes 0 ·

0 Answers