Search code examples
azuredockerbitnamiazure-filesazure-web-app-for-containers

How to mount a volume (Azure File Share) to a bitnami-based docker image on Azure (Web App for Container)?


I have the Matomo Docker Image from https://github.com/bitnami/bitnami-docker-matomo that I run in a Web App for Container on Azure with my own Azure Container Registry (ACR).

Also, I have an Azure Storage Account with a File Share available.

What I would like to achieve is to mount a persistent storage (File Share from Az Storage Account) to it so I don't loose the config and plugins installed of Matomo.

I tried using the Mount Storage (Preview), but I couldn't get it to work.

Name: matomo_data Storage Type: Azure Files Mount path: /bitnami

As described in: https://github.com/bitnami/bitnami-docker-matomo#persisting-your-application

This didn't work.

I also tried via the setting WEBSITES_ENABLE_APP_SERVICE_STORAGE = true on the Web App for Containers, but apparently seems not to do anything either.

I would appreciate any hints here, as otherwise I would have to make a custom docker image, push it to the registry, with a custom docker compose file, which I would like to avoid.

Thanks a lot in advance for any hints on this!


Solution

  • To mount the Azure File Share to the Web App for Container, as I think, it's not simple persistent storage, it's a share action. See the Caution below:

    Linking an existing directory in a web app to a storage account will delete the directory contents. If you are migrating files for an existing app, make a backup of your app and its content before you begin.

    So, if you want to mount the file share to the web app to persist the storage, you need to upload all the files needed to the file share first. And the steps that mount the Azure File Share to the Web app are here. It shows for Windows, and for Linux is also the same way.

    But I will suggest you'd better use the persistent storage following the steps here. This way will create persistent storage at the beginning and will not delete the directory contents.