Plugins and Docker for Mac

Expected behavior

Run Docker plugins.

Actual behavior

Can’t run docker plugins.

Information

  • the output of:
    • Moby Menu > Diagnose & Feedback on OSX
Docker for Mac: version: win-beta-v1.12.0-rc5-beta21-73-g9cd1dc2
OS X: version 10.11.6 (build: 15G31)
logs: /tmp/D0B5A60F-4117-48A7-87F7-0EDB98F5B04F/20160803-210638.tar.gz
[OK]     docker-cli
[OK]     app
[OK]     moby-syslog
[OK]     disk
[OK]     virtualization
[OK]     system
[OK]     menubar
[OK]     osxfs
[OK]     db
[OK]     slirp
[OK]     moby-console
[OK]     logs
[OK]     vmnetd
[OK]     env
[OK]     moby
[OK]     driver.amd64-linux

Diagnostic ID: D0B5A60F-4117-48A7-87F7-0EDB98F5B04F

  • a reproducible case if this is a bug, Dockerfiles FTW

Here is the repo for the plugin I’m trying to use: https://github.com/CWSpear/local-persist (I am the author)

  • page URL if this is a docs issue or the name of a man page

The popup mentions looking to the docs for more about reserved paths. I couldn’t find anything in the docs.

  • host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc )

OS X 10.11.6

Steps to reproduce the behavior

Run:

docker run -d \
    -v /run/docker/plugins/:/run/docker/plugins/ \
    -v /data/plugin-data/:/var/lib/docker/plugin-data/ \
    -v /data/:/data/ \
    --name local-persist \
        cwspear/docker-local-persist-volume-plugin

This command works on a “regular” Docker host (tested with Docker 1.12 on Ubuntu 16.04). On Docker for Mac, you get this error:

docker: Error response from daemon: Mounts denied:
The path /run/docker/plugins/
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.

If I try to add /run to my shared path in the Docker for Mac preferences, I get this error:

Path Error

In general, how does one run plugins on Docker for Mac? It would be preferable to run then directly on the host. (Docker recommends running plugins outside of containers. See last paragraph under What plugins are from the Plugins API docs.) As it stands, I can’t do either.

Hi Cameron,

I’ve submitted a PR to the namespace docs to explain the shared namespace model better:

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. If an OS X path is not shared and does not exist in th VM, an attempt to bind mount it will fail rather than create it in the VM. Paths that already exist in the VM and contain files are reserved by Docker and cannot be exported from OS X.

Essentially, the path /run is used by the VM during normal operation and we do not allow overmounts from OS X into Linux. I suggest trying to share the path /run/docker/plugins which does not exist in the VM and should be allowable.

I hope this helps with your issue and I look forward to seeing local-persist work seamlessly with Docker for Mac. Please reach out again if there is anything we can do to help.

Thanks for participating in the Docker for Mac Beta!

David

Ah, ok. I assumed any subdirectory of /run would give me the same error. I was successful in sharing /run/docker/plugins via the preference pane, but now when I try to start the plugin, I get this error:

chown /run/docker/plugins/local-persist.sock: operation not supported

(The chown call is originating from docker/go-connections code.)

I tried making /run/docker/plugins’ permissions 0777 and tried changing the owner to both my Mac user and root to no avail.

That is a regression introduced in Beta 16. Thanks for finding it!

I’ve fixed it and added a test for it (before, we only tested chmod, not chown, on sockets).

The fix should appear in Beta 22.