9

I'm using Docker Desktop vrs 2.1.1.0 (edge channel) on Mac Os Mojave. I need to include a file from /usr/local folder, as shared file in Docker's preferences, but the /usr folder is not displayed while browsing the folders. The option to write the folder/file name manually is also not available. See the print screens. Does anyone have a clue how to add those folders in preferences?

File sharing paths are not manually editable

Folders like /usr or /Volumes don't appear in folder browsing

Update I need to share this actual folder: /usr/local/share/dotnet/sdk/NuGetFallbackFolde and not entirely the /usr/local as I wrote above. But as I'm not able to select at least the /usr folder, this is why I've mentioned only the /usr/local folder.

Update I've downgraded progressively up to Docker Community Edition 2.0.0.3 2019-02-15. That seems to be the last version with the old user interface. With this version the folder browser dialog from file sharing displays all the folders and also manual editing of the file paths works. On versions Docker Desktop Community 2.1.0.1 and Docker Desktop Community 2.1.0.2, which have the new UI, it doesn't work.

Vlad Barjovanu
  • 103
  • 1
  • 6

3 Answers3

26

I have faced the same problem and could sort it out using the latest docker version.

You can edit ~/Library/Group\ Containers/group.com.docker/settings.json.

Then add whatever path you need, in my case was a synthetic link (created through synthetic.conf), this way by manual editing the file the UI does not auto resolve the link so it works well.

{
  "filesharingDirectories" : [
    "\/Users",
    "\/Volumes",
    "\/datadrive",
    "\/private",
    "\/tmp"
  ],
Rafael
  • 7,002
  • 5
  • 43
  • 52
Federico Piazza
  • 30,085
  • 15
  • 87
  • 123
  • 2
    For anyone having a hard time finding this file, ensure you escape the space between 'Group' and 'Containers' with a backslash e.g `vim ~/Library/Group\ Containers/group.com.docker/settings.json` – spuder Jun 14 '20 at 15:30
  • 2
    Also need to restart docker afterwards in order for it to appear - thanks for the tips ^ – user2498045 Jul 24 '20 at 19:55
  • 1
    I faced this on docker desktop v4.15.0 ( latest today ) and solved using this, Thanks @Federico – Jay99 Jan 11 '23 at 18:40
13

In the File Sharing tab of Docker's Preferences, click the Add Directory button (+) and browse to the root directory of your Mac drive. Now press Command+Shift+Dot to show hidden directories. This will make the usr directory visible.

You will now be able to browse to the /usr/local/share/dotnet/sdk/NuGetFallbackFolder directory.

Andre
  • 131
  • 1
  • 4
0

I think you have to add application to the list of trusted apps. Take a look here:

http://www.owsiak.org/macos-mojave-and-accessing-timemachine-data/

Unless you add Full Disk access, applications are not able to browse certain areas of your volume.

Update

Unfortunately, it looks like giving access to whole drive is not a solution in this case.

It looks like Docker Desktop is not quite happy with sharing /usr/local directory.

enter image description here

Oo.oO
  • 12,464
  • 3
  • 23
  • 45
  • Unfortunately it didn't help. I've added Docker, restarted it, restarted even the OS and it's still the same issue. Anyway, other apps are displaying all folders and are not granted full access in security & privacy mac os settings. – Vlad Barjovanu Sep 06 '19 at 09:45
  • You are right. It's a different issue. According to Docker Desktop, `/usr`, `/usr/local` are reserved and it's not possible to add them inside `File Sharing`. – Oo.oO Sep 06 '19 at 10:41
  • Can you please point me to where you've seen this documentation, that it's impossible? I'm building a simple sample from .net core documentation, and it's the .net core that needs access to these paths. Moreover Docker Desktop is showing only 4 folders, so much more folders are missing, not only the /usr. All the folders that are by default shared /Users /Volumes /private and /tmp are not visible when browsing. So for instance if I remove one of these folders from File Sharing, I can not add it back. – Vlad Barjovanu Sep 06 '19 at 12:56
  • In my case, this is a message I am getting when I try to add `/usr`. I will add it to answer. – Oo.oO Sep 06 '19 at 13:35
  • I see. I need actually to add this specific subdirectory `/usr/local/share/dotnet/sdk/NuGetFallbackFolder`, but I didn't mentioned all subfolders, as I don't see the option to add any subfolder under `/usr`. Are you using Docker on Linux or how were you able to at least try to add the `/usr/local ` folder? – Vlad Barjovanu Sep 06 '19 at 14:13
  • I am using it on macOS. If I double click path, I am able to edit it. No issues here. – Oo.oO Sep 06 '19 at 14:50
  • I see. So on my mac OS this doesn't work with Docker Desktop version 2.1.0.2. When I'm double clicking an existing path, there's no option to edit it. Check out this video here: https://youtu.be/_z5mZC0aMII – Vlad Barjovanu Sep 07 '19 at 10:52