Skip to content

Mounting subdirectories of symlinks into containers is not possible #412

Closed

Description

@Mactory

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.

Activity

  1. dsheets commented on Sep 26, 2016

    @dsheets
    Contributor

    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.

  2. 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
  3. Mactory commented on Sep 28, 2016

    @Mactory
    Author

    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

  4. nmcalabroso commented on Nov 1, 2016

    @nmcalabroso

    +1 to this issue

  5. ebuildy commented on Nov 2, 2016

    @ebuildy

    If this can help, you can use NFS mounts instead of D4M shares, this should let you more flexibility (and speed ^^).

  6. nmcalabroso commented on Nov 28, 2016

    @nmcalabroso

    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.

  7. dsheets commented on Jan 16, 2017

    @dsheets
    Contributor

    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.

  8. pengisgood commented on Feb 18, 2020

    @pengisgood

    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

  9. docker-robott commented on Jun 19, 2020

    @docker-robott
    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

  10. locked and limited conversation to collaborators on Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions