Mounting from persistent storage into azure multi container app

971 Views Asked by At

I'm trying to build a multiconatiner app with azure. I'm struggling with accessing persistent storage. In my docker-compose file I want to add the config file for my rabbitmq container. I've mounted a fileshare to the directory "/home/fileshare" which contains the def.json. On the cloud it doesn't seem to create the volume, as on startup rabbitmq can't find the file. If i do this locally and just save the file somewhere it works.

Docker Compose File:

version: '3.8'
services:

   rabbitmq:
      image: rabbitmq:3-management-alpine
      volumes:
       - /home/fileshare/def.json:/opt/rabbitmq-conf/def.json
      expose:
        - 5672
        - 15672
      environment:
        RABBITMQ_DEFAULT_USER: guest
        RABBITMQ_DEFAULT_PASS: guest
        RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: -rabbitmq_management load_definitions "/opt/rabbitmq-conf/def.json"
      networks:
        - cloudnet 
        
networks:
   cloudnet:
      driver: bridge    
3

There are 3 best solutions below

0
On BEST ANSWER

The solution to this problem seems to be to use ftp to access the webapp and save the definitions file. Docker-Compose is in preview mode (since 2018), and a lot of the options are actually not supported. I tried mounting the storage to a single container app and used ssh to connect to it, and the file is exactly where one would expect it to be. With a multi-container app this doesn't work. I feel like the docker-compose feature is not yet fully supported

5
On

You need to use the WEBAPP_STORAGE_HOME env variable that is mapped to persistent storage at /home.

${WEBAPP_STORAGE_HOME}/fileshare/def.json:/opt/rabbitmq-conf/def.json
3
On

On my understanding, you want to mount the Azure File Share to the container rabbitmq and upload the def.json file to the file share so that you can access the def.json file inside the container.

Follow the steps here to mount the file share to the container. And it just supports to mount the file share, not the file directly.