0

I'm currently attempting to use Azure's docker compose integration to deploy a visualization tool. The default compose file can be found here. Below is a snippet of the file:

services:
  # other services omitted
  cbioportal-database:
    restart: unless-stopped
    image: mysql:5.7
    container_name: cbioportal-database-container
    environment:
      MYSQL_DATABASE: cbioportal
      MYSQL_USER: cbio_user
      MYSQL_PASSWORD: somepassword
      MYSQL_ROOT_PASSWORD: somepassword
    volumes:
     - ./data/cgds.sql:/docker-entrypoint-initdb.d/cgds.sql:ro
     - ./data/seed.sql.gz:/docker-entrypoint-initdb.d/seed.sql.gz:ro
     - cbioportal_mysql_data:/var/lib/mysql

One of services it uses is based on the official mysql image, which allows the developer to put sql files into the /docker-entrypoint-initdb.d folder to be executed the first time the container starts. In this case, these are sql scripts used to create a database schema and seed it with some default data.

Below is a snippet I took from Docker's official documentation in my attempt to mount these files from a file share into the cbioportal-database container:

services:
  # other services omitted
  cbioportal-database:
    volumes:
      - cbioportal_data/mysql:/var/lib/mysql
      - cbioportal_data/data/cgds.sql:/docker-entrypoint-initdb.d/cgds.sql:ro
      - cbioportal_data/data/seed.sql.gz:/docker-entrypoint-initdb.d/seed.sql.gz:ro

volumes:
  cbioportal_data:
    driver: azure_file
    driver_opts:
      share_name: cbioportal-file-share
      storage_account_name: cbioportalstorage

Obviously, that doesn't work. Is there a way to mount specific files from Azure file share into the cbioportal-database container so it can create the database, its schema, and seed it?

Kurt Mueller
  • 3,173
  • 2
  • 29
  • 50

1 Answers1

1

I tried to reproduce but unable mount a single file/folder from Azure File Share to Azure Container Instance. file share will treated as common once you mount as volume to the container or host.

enter image description here enter image description here

Here one more thing notice whatever the files you will update in file share it will update in container as well after you mount the file share as volume to the container. May this be the reason we can not mount specific file and folder as volume in container.

enter image description here

There are some limitations to this as well

• You can only mount Azure Files shares to Linux containers. Review more about the differences in feature support for Linux and Windows container groups in the overview.

• You can only mount the whole share and not the subfolders within it.

• Azure file share volume mount requires the Linux container run as root.

• Azure File share volume mounts are limited to CIFS support.

• Share cannot be mounted as read-only.

• You can mount multiple volumes but not with Azure CLI and would have to use ARM templates instead.

Reference: https://learn.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files https://www.c-sharpcorner.com/article/mounting-azure-file-share-as-volumes-in-azure-containers-step-by-step-demo/

RahulKumarShaw
  • 4,192
  • 2
  • 5
  • 11