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:
Install Docker version 17.12.1-ce, build 7390fc6 on CentOS 7
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’
Use yum to install cifs-utils package
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.
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.