How do runtime mounts work on Docker for Mac beta?

My question might be completely inane but please be kind, I’ve had quite a bruising experience with Docker so far.

I want to, at runtime, mount a directory from my mac into the container.

Expected behaviour

Docker for Mac Beta mounts a volume no matter where it’s based.

Actual behaviour

It seems to me that files have to be under /Users - which seemed to be the case when I was using Docker Machine ( for some reason to do with the VM it was running on apparently), but I expected the beta would allow any directory to be mounted?

Information

OS X: version 10.11.5 (build: 15F34)
Docker.app: version v1.11.1-beta13.1
Running diagnostic tests:
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160531-160923.tar.gz
Most specific failure is: No error was detected
Your unique id is: REDACTED
Please quote this in all correspondence.

Steps to reproduce the behavior

I have a project called foo. I have copied this project into two places - $HOME/foo and /var/www/labs/foo. I’m using the postgres image, although I get identical results no matter what image I use.

➜ foo git:(ci) ✗ docker run -v $HOME/foo:/foo:ro postgres ls /foo
package.json
… other files that I’d expect to see

➜ foo git:(ci) ✗ docker run -v /var/www/labs/foo:/foo:ro postgres ls /foo
integration-test
… Not sure where it’s getting this - this is another directory in my project.

Hello,

From https://beta.docker.com/docs/mac/osxfs/#namespaces:

Much of the OS X file system that is accessible to the user is also available to containers using the -v bind mount syntax. You can share files in /Users, /Volumes, /private, and /tmp directly. For the Beta only, the rest of the user-accessible file system is mounted under /Mac. All other paths used in -v bind mounts are sourced from the Moby Linux VM running the Docker containers, so arguments such as -v /var/run/docker.sock:/var/run/docker.sock should work as expected.

We are aware that this is a far from optimal or intuitive interface to this functionality and we are presently working toward streamlining it and making it more discoverable.

Thanks for your participation in the Docker for Mac Beta!

Best regards,

David

I see, docker run -v /Mac/var/www/labs/foo:/foo node:argon ls /foo behaves how I would expect.

Thank you for clarifying this.