Docker Community Forums

Share and learn in the Docker community.

Acces denied at shared directory

Hello folks,

I’ve a problem with my docker running on Ubuntu VM.
I would share a directory (sf_VMSharing) between host (ubuntu) to docker, to do that i run (from host shell) :

sudo docker run -v v/media/sf_VMSharing/:/media/sf_VMSharing:Z -ti <containername>

on docker I see the directory but the access is denied

The “Z” in append @"v/media/sf_VMSharing/:/media/sf_VMSharing:"is an option found on different forum.
In any case, removing this flag, the behaviour is the same

Thanks in advance for any suggestion.

Please, use the </> button to format codes. The markdown formatter interpreted your <containername> placeholder as an html tag and completely disappeard from the post. I fixed it for you. Always check your messages after posting and edit it when it does not look like as you expected.

What is your actual command and the exact error message? In the example you use an invalid volume name. It can’t contain slashes. If you want to use a bind mount, you need to use an absolute path beginning with “/”.

Apologize for my mistake in post edinting.
The error is “access denied”, I think it coul be related at group privilage

I knew it from the title but is this the whole message? The context is often important. Also I would like to see which command gives you this error message. As I mentioned in my previous message, the command you posted does seem valid. Is the docker run command which gives you the error message without creating the container or a process inside the container?

Hi, I run the command from Linux shell

Which command? Please, give us a step by step description with examples. Copy and paste the commands so I can be sure the error message was given by that exact command.

Example:

I run this command:

sudo docker run -v /mnt/media:/data -ti centos:8 bash -c '/usr/local/bin/run-forrest-run'

I checked that the container is created and docker logs gives me this error message:

Cannot write /data/database.db. Access denied.

I hope I was clear enough to show you what I expect from you.

sudo docker run -v v/media/sf_VMSharing/:/media/sf_VMSharing:Z -ti ubuntu_ubuntu18

and when I check the docker logs, I see “cd sf_VMSharing/ : Permission denied”

Thanks