Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker-desktop for MacOs can't add /usr/local folder in Preferences/File-Sharing

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.

like image 721
Vlad Barjovanu Avatar asked Sep 06 '19 09:09

Vlad Barjovanu


People also ask

How do I enable file sharing in Docker?

In order to share Windows folders with Docker containers, you first need to configure the "Shared Drives" option in Docker settings. Once the Shared Drives option is configured, you can mount any folder on shared drives with the "-v" (volume) flag.

How do I run a docker image locally on Mac?

Install and run Docker Desktop on MacDouble-click Docker.dmg to open the installer, then drag the Docker icon to the Applications folder. Double-click Docker.app in the Applications folder to start Docker.

Where is var lib Docker on MacOS?

Debian: /var/lib/docker/ Windows: C:\ProgramData\DockerDesktop. MacOS: ~/Library/Containers/com.


2 Answers

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"
  ],
like image 95
Federico Piazza Avatar answered Oct 17 '22 21:10

Federico Piazza


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.

like image 23
Andre Avatar answered Oct 17 '22 20:10

Andre