You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mounting subdirectories of symlinks into containers is not possible #412
In my setup, I mount a subfolder of etc into my docker container (e.g. /etc/foo). (On OS X '/etc' is actually a symlink to "/private/etc".) I want to be able to use the same scripts on Linux and on OS X machines, so I use the /etc/foo path for mounting these folders.
The /etc folder is not shared as default with docker, so I tried adding "/etc" to the shared folders but I got a message saying, that "/etc is reserved by docker". When I try to add "/etc/foo" directly to the shared folders, it gets resolved to "/private/etc/foo".
Currently I see no possibility to mount "/etc/foo" on OS X into a docker container though it works on Linux systems.
Is there a reason for this restriction, or is it just an oversight, as adding "/etc/foo" to the shared folders should work but is broken by the system's folder selection which resolves the symlink?
Thanks for reporting this. This is an issue with the OS X directory chooser that does not allow the user to select paths with unresolved components (only the last component remains unresolved if the option to retain verbatim paths is used). We need to use a different method to select the paths to export to Docker. This issue has been tracked internally since August 16 and I have started a thread with our GUI team about getting it resolved.
Thanks for using Docker for Mac and sorry for this annoying problem.
changed the title [-]Not possible to mount subfolders of /etc in container[/-][+]Mounting subdirectories of symlinks into containers is not possible[/+]on Sep 27, 2016
Thank you for your reply.
For now I have helped myself by adding an additional local.yml for docker-compose that overwrites /etc/foo:/etc/foo to use the resolved form /private/etc/foo:/etc/foo
Just some update, I managed to mount directories via symlinks using docker-compose. This worked for me since I'm just concerned on building a local development environment rather a production one.
This was fixed in Beta 33 and has been recently improved in Beta 35 or 36 so that exported directory paths are editable and now manually enterable by editing a blank entry at the end of the list.
Thanks for your patience with this issue and for using Docker for Mac. This improvement should reach the stable channel in a week or two.
After I upgrade to the latest version on Mac os 10.15.3. I get Mounts denied error again.
I try to mount /var/data/test:/var/data/test in the docker compose file. And I choose the folder in the file sharing menu, it turns out to be /private/var/data/test.
If I try to run docker-compose up, always get Mounts denied error.
ERROR: for c9430ce45017_xxx-SNAPSHOT Cannot start service xxx: Mounts denied:
The path /var/data/test
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.
Activity
dsheets commentedon Sep 26, 2016
Thanks for reporting this. This is an issue with the OS X directory chooser that does not allow the user to select paths with unresolved components (only the last component remains unresolved if the option to retain verbatim paths is used). We need to use a different method to select the paths to export to Docker. This issue has been tracked internally since August 16 and I have started a thread with our GUI team about getting it resolved.
Thanks for using Docker for Mac and sorry for this annoying problem.
[-]Not possible to mount subfolders of /etc in container[/-][+]Mounting subdirectories of symlinks into containers is not possible[/+]Mactory commentedon Sep 28, 2016
Thank you for your reply.
For now I have helped myself by adding an additional local.yml for docker-compose that overwrites /etc/foo:/etc/foo to use the resolved form /private/etc/foo:/etc/foo
nmcalabroso commentedon Nov 1, 2016
+1 to this issue
ebuildy commentedon Nov 2, 2016
If this can help, you can use NFS mounts instead of D4M shares, this should let you more flexibility (and speed ^^).
nmcalabroso commentedon Nov 28, 2016
Just some update, I managed to mount directories via symlinks using
docker-compose. This worked for me since I'm just concerned on building a local development environment rather a production one.dsheets commentedon Jan 16, 2017
This was fixed in Beta 33 and has been recently improved in Beta 35 or 36 so that exported directory paths are editable and now manually enterable by editing a blank entry at the end of the list.
Thanks for your patience with this issue and for using Docker for Mac. This improvement should reach the stable channel in a week or two.
pengisgood commentedon Feb 18, 2020
After I upgrade to the latest version on Mac os 10.15.3. I get

Mounts deniederror again.I try to mount
/var/data/test:/var/data/testin the docker compose file. And I choose the folder in thefile sharingmenu, it turns out to be/private/var/data/test.If I try to run
docker-compose up, always getMounts deniederror.I also post a question here
docker-robott commentedon Jun 19, 2020
Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked