I tried to mount a Docker container directory by running the following:
mount -t cifs -o username=rusnlk,domain=corpnet,uid=root,gid=root,file_mode=0777,dir_mode=0777 //rusnlk/shared /opt/mnt`
This gave the error:
mount: bad address 'rusnlk'
When I changed rusnlk
with the IP address, this error occurred
mount: permission denied (are you root?)
Then I added the permission flags --privileged
and --cap-add CAP_SYS_ADMIN
. With docker run
while starting the container, this error occurred:
mount: mounting //rusnlk/shared on /opt/mnt failed: Invalid argument
Is there any solution for this situation? Is there any other missing detail in the command?
After installing cifs package the mounting command worked!
It was because the base image I used was an Alpine image
. Unlike Linux
Alpine doesn't give proper error that the package is missing rather gives a common error
invalid argument
to install cifs packages use: apk add cifs-utils