Docker Community Forums

Share and learn in the Docker community.

Docker for Mac beta does not handle symlinks when mounting volumes

Expected behavior

docker run -ti -v /var/www/vhosts:/var/www/vhosts ubuntu

The above command should mount /var/www/vhosts directory to the same path on the container

Actual behavior

The target path exists, but is empty

On Mac /var directory is a symlink to /private/var. If a path starting with /var is used for volume mounting, the target directory on the container is empty. But if the real path (beginning with /private/var) is used, the directory is mounted correctly.

This works

docker run -ti -v /private/var/www/vhosts:/var/www/vhosts ubuntu


OS X: version 10.11.4 (build: 15E65) version v1.11.1-beta10
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Error exec: echo “00000003.0000f3a6” | nc -U /var/tmp/com.docker.vsock/connect > /tmp/20160505-033854/diagnostics.tar: exit 1
Docker logs are being collected into /tmp/20160505-033854.tar.gz
Most specific failure is: No error was detected
Your unique id is: 91AF123F-7EB1-434D-AC08-C394D7E4C439
Please quote this in all correspondence.

In this case, I don’t believe it is the symlink that causes your issue. If you read in the section Namespaces, you will find that /Users, /Volumes, /tmp, and /private are the only directly shared paths. If you wish to use another path from the host, you need to prefix it with /Mac. This /Mac prefix and the behavior of host mounts will be changing soon and definitely before Docker for Mac leaves beta so please do no rely on it or keep careful record of where you use it so that you can easily change it later.

Hope this helps,


1 Like

Thank you. Using the /Mac prefix worked.

Can you please explain how to accomplish this via the File Sharing GUI/app?

Many thanks in advance

1 Like

Could you please describe what you are trying to do? The information at may help you. If it does not, please post back here with more details of your issue and I’ll be happy to help (or file a bug/issue report if there is something wrong/missing).

Hi David, I was trying to use the Docker Mac app to implement the /Mac prefix workaround for the /var symlink to /prefix/var in order to use a script I found to run Kubernetes in Docker as per

1 Like

Also having this issue. Trying to run scripts that reference /var/lib/somefolder and unable to find a solution.
Using the Docker preferences GUI, trying to add /var/lib/somefolder in the file sharing tab is automatically translated to /private/var/lib/somefolder in the GUI and not found by the script.

+1 to this issue.

Also, is it possible to do all these GUI commands via CLI or something else? :frowning:

Same issue. Need to be able to set /var/www not /private/var/www