Does azure app service support volume binding

dennis muturi 0 Reputation points
2025-02-01T10:16:47.87+00:00

I was deploying an api to app service using containers.I wanted to cache responses from my api so that it can improve performance.Therefore I added redis as a side car to do the caching.The issue is that I cannot add a volume for the redis for persistence as volume mounts are available for the main container for mapping volumes.I want to perform the /data in the redis container to a storage account file share.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,262 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Chiugo Okpala 80 Reputation points MVP
    2025-02-02T21:35:01.8266667+00:00

    @dennis muturi Azure App Service does support volume binding for containers, but it's a bit different from traditional volume mounts. Here's how you can achieve persistence for your Redis container:

    Steps to Mount Volumes in Azure App Service for Containers:

    1. Enable App Service Storage:
      • Go to your App Service in the Azure portal.
      • Navigate to Configuration > Path Mappings.
      • Enable App Service Storage by setting WEBSITES_ENABLE_APP_SERVICE_STORAGE to true.
    2. Create a Storage Mount:
      • In the Path Mappings section, create a new Azure Storage Mount.
      • Define the Mount Path within your container (e.g., /data/redis).
      • Save the configuration.
    3. Configure Your Container:
      • Use Docker Compose to define the volume mount.
      • Example Docker Compose file:
             version: '3.7'
             services:
               redis:
                 image: redis:latest
                 volumes:
                   - ${WEBAPP_STORAGE_HOME}/redis:/data/redis
                 restart: always
             ```[_{{{CITATION{{{_1{Volume Mounts in Azure App Service for Containers - hals.app](https://hals.app/blog/azure-app-service-container-volume-mounts/)
             
             
             
        
    4. Deploy Your Container:
      • Deploy your container using the Docker Compose file.
      • Ensure the container has access to the mounted volume.

    By following these steps, you can persist data in your Redis container using Azure App Service storage. This setup should help improve the performance of your API by caching responses effectively.

    See: https://hals.app/blog/azure-app-service-container-volume-mounts/


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.