3

I am using a MySQL Docker container where I want to use a Azure File Share. To create an MySQL Docker container I use the following Buildscript.

FROM mysql:5.7
RUN apt-get update && apt-get upgrade && apt-get install sudo
RUN sudo apt install cifs-utils -y
RUN sudo apt-get install curl -y
RUN cd home 
RUN mkdir install
RUN cd install
RUN curl curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

When I enter this container, I use the following command selected from the Azure Portal and create a bash script.

enter image description here

When I execute the script, I get this error:

Unable to apply new capability set.

Can you please help me to mount the Azure File Share to Linux !

Many thanks,

Erik

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Erik hoeven
  • 1,442
  • 6
  • 26
  • 41

1 Answers1

7

To be able to mount Azure File shares you need to add "capabilities" to your container. See https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities

In this case, if you run docker run --cap-add=SYS_ADMIN --cap-add=DAC_READ_SEARCH my_image (add those two --cap-add options) then your container will be able to mount the shares.

mherzig
  • 1,528
  • 14
  • 26
  • 1
    That is when running. But what about when building the image? – CiprianIonescu May 11 '22 at 09:03
  • 1
    @CiprianIonescu I'm not quite sure what you are looking to do. If it's add capabilities during the build phase (say, in a Dockerfile) that won't work--the point of capabilities is to allow higer-level access than the default, and that's something that can't be baked into an image. – mherzig May 17 '22 at 04:06