title: Cifs mount in docker container with docker-compose
body: <p>I want to cif mount a directory into a docker-container.
  As there are solutions to this, I tried the --privileged flag and setting the capabilities needed:</p>
  <p>docker-compose.yaml:</p>
  <pre><code>version: '2.0'
  services:
    mounttest:
      image: test
  
      privileged: true
      cap_add:
        - SYS_ADMIN
        - DAC_READ_SEARCH
      
      restart: unless-stopped
      container_name: test
      mem_limit: 500m
      build:
        context: .
        dockerfile: Dockerfile
      volumes:
        - .:/apps/docker-test/
  </code></pre>
  <p>Dockerfile:</p>
  <pre><code>FROM ubuntu:18.04
  
  ADD . /apps/docker-test/
  
  # APT-GET
  RUN apt-get update &amp;&amp; apt-get install -y \
      sudo \
      cifs-utils
  
  # CHMOD SHELL SCRIPTS
  RUN chmod 0755 /apps/docker-test/run.sh
  RUN chmod 0755 /apps/docker-test/build.sh
  
  RUN /apps/docker-test/build.sh
  CMD bash /apps/docker-test/run.sh
  </code></pre>
  <p>build.sh:</p>
  <pre><code>mkdir -p /test_folder
  echo &quot;Mount&quot;
  sudo mount -t cifs -o username=XXX,password=XXX,workgroup=XX //server/adress$ /test_folder
  </code></pre>
  <p>run.sh starts a python script</p>
  <p>This does not work, instead:</p>
  <pre><code>docker-compose build
  </code></pre>
  <p>gives me the error:</p>
  <pre><code>Unable to apply new capability set
  </code></pre>
  <p>All the solutions I found only mention the privileged flag or capabilities, which are set. Can anyone help?</p>