Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mounting subdirectories of symlinks into containers is not possible #412

Closed
Mactory opened this issue Aug 24, 2016 · 8 comments
Closed

Mounting subdirectories of symlinks into containers is not possible #412

Mactory opened this issue Aug 24, 2016 · 8 comments

Comments

@Mactory
Copy link

Mactory commented Aug 24, 2016

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?

Thank you for your help.

@dsheets
Copy link
Contributor

dsheets commented 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.

@dsheets dsheets changed the title Not possible to mount subfolders of /etc in container Mounting subdirectories of symlinks into containers is not possible Sep 27, 2016
@Mactory
Copy link
Author

Mactory commented 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
Copy link

+1 to this issue

@ebuildy
Copy link

ebuildy commented 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
Copy link

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
Copy link
Contributor

dsheets commented 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.

@dsheets dsheets closed this as completed Jan 16, 2017
@pengisgood
Copy link

pengisgood commented Feb 18, 2020

After I upgrade to the latest version on Mac os 10.15.3. I get Mounts denied error again.
docker

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.

I also post a question here

@docker-robott
Copy link
Collaborator

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

@docker docker locked and limited conversation to collaborators Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants