Unable to mount CIFS share inside a docker container

Hello,

I have a server which hosts shares. I have another CentOS 7 host which has docker installed. I am running the CentOS 7 docker image that I pulled from docker hub.

I installed cifs-utils package in it & then tried to mount the share using the following command -

Issue type: Unable to mount remote shares in docker container

OS Version/build: CentOS 7

App version: Docker version 17.12.1-ce, build 7390fc6

Steps to reproduce:

  1. Install Docker version 17.12.1-ce, build 7390fc6 on CentOS 7
  2. Pull centos 7 latest docker image & run a container -

docker run -it --privileged --cap-add SYS_ADMIN --net=host --name=test centos sh -c ‘/bin/bash’

  1. Use yum to install cifs-utils package
  2. Use docker exec to get access to the container shell & use the following command to mount the share -

mount -t cifs \\\share1 -o username=administrator,password=password,domain=domain1,vers=3.0 /media

On executing the mount command, I get he following error-

mount error(38): Function not implemented

Any idea how to fix this. I did some research on the net & used the privileges & cap add arguments as well, but that did not help.

Thanks

Bhushan Pathak

I get the same error even with a newer version of docker -

Docker version 18.05.0-ce, build f150324

If this is your expected workflow, you’ll find a virtual machine easier to work with, less fragile, and more isolated from the host system.

I need to make this work with docker containers, using virtual machines is not an option.

Any idea how to fix this, anyone?

The usual path is to mount the volume either on the host or via a Docker volume, and then use the docker run -v option to attach it to the container when you docker run it.

Note that you will routinely need to delete and recreate Docker containers to make changes like, say, attaching different volumes to containers. This is where I say a VM-based solution would be “less fragile” than a Docker-based solution: anything you do in an interactive shell in a Docker container will get lost when you delete the container.