How to mount connect file share folder in Azure Batch container

Chris M 30 Reputation points
2024-07-24T18:30:26.2833333+00:00

I have created a batch pool/jobs/tasks, uploaded container image and connected to an Azure File Share.

The container image, is a python program which should read data from ./data/inputs

...and output everything in ./data/outputs.

In my connected storage file share, I have folders ./data/inputs and ./data/outputs in the root of the storage file share. I have added the storage to the pool, and everything is reporting as successfully connected (I have created all roles, images etc).

When I run locally on my desktop docker using the options docker run  --mount type=bind,source="$(pwd)"/data,target=/data -it

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
327 questions
{count} votes

Accepted answer
  1. Vinodh247 16,116 Reputation points
    2024-07-25T00:18:30.91+00:00

    Hi Chris Martis,

    Thanks for reaching out to Microsoft Q&A.

    Please do not respond with CLI. I first need to understand how to do this from the Azure portal website

    To mount an Azure File Share to an Azure Batch container using the Azure portal, follow these steps:

    1. Create or Select an Azure Batch Pool:
      • Navigate to your Azure Batch account in the Azure portal.
      • Select "Pools" from the left navigation pane.
      • Create a new pool or select an existing one.
    2. Configure File Share Mounting:
      • Go to the "Configuration" section of your pool.
      • Under "Mount configuration," select "Add" to mount an Azure File Share.
      • Fill in the required details:
        • Storage account name: The name of your storage account.
        • File share name: The name of your Azure File Share.
        • Mount path: The path where the file share will be mounted on the compute nodes (e.g., '/mnt/data').
        • Account key: The key for accessing the storage account.
    3. Verify Mount Configuration:
      • Ensure the file share is correctly added to the mount configuration.
      • Save the changes and ensure the pool is updated.
    4. Submit a Job to the Pool:
      • Navigate to the "Jobs" section and create a new job.
      • Configure the job to use the pool with the mounted file share.
    5. Configure Task to Use Mounted File Share:
      • When creating tasks for the job, ensure the task command references the mounted path (ex: '/mnt/data/inputs' and '/mnt/data/outputs').
    6. Run and Monitor the Job:
      • Submit the job and monitor its progress.
      • Verify that the tasks can access the mounted file share paths.

    By following the above steps, the Azure File Share will be mounted to the specified path on each compute node in your Azure Batch pool, allowing your container to access the required directories.

    Let me know if this worked for you!

    Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Chris M 30 Reputation points
    2024-07-25T19:56:28.1033333+00:00

    right, so I managed to fix this. The issue was

    1. as you pointed out, the container had to have the folders created inside it to map to it
    2. the mounting options were left blank. I had to set up permissions dir_mode, file_mode etc.

    Thanks for the help.

    1 person found this answer helpful.

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.