Mounting from persistent storage into azure multi container app

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    

2 answers

  • answered 2020-09-24 13:18 CSharpRocks

    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
    

  • answered 2020-09-25 06:51 Charles Xu

    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.