Docker Community Forums

Share and learn in the Docker community.

Plugin using a tcp endpoint for communication instead of a unix socket


(Sandeepkasargod) #1

I’m trying to develop a docker plugin: Using the unix socket by specifying it in the config.json->interface->socket works and I’m able to get ‘docker plugin enable’ return success after ‘docker create plugin’.
When I instead tried a spec file in /etc/docker/plugins/myplugin.spec that contains ‘tcp://<ip>:<port>’ into the plugin’s rootfs(*) , the ‘docker plugin enable’ fails with the messages that the connection was refused as it a unix socket does not exist.

According to the docs (https://docs.docker.com/engine/extend/plugin_api/#plugin-discovery), docker daemon first scans for unix sockets and then tries .spec files if the unix socket doesn’t exist but this doesn’t seem to be happening. Unfortunately the documentation available is not heavy on details.
Is there supposed to be a special value for ‘socket’ in the config.json ? Tried without ‘socket’, and ‘socket’ with empty value but neither helped.

* - also tried creating the spec file in the host where docker daemon runs but that didn’t seem to work either.

Docker version 18.05.0-ce, build f150324 on Ubuntu 18.04


(Sandeepkasargod) #2

Was able to get this working: create the spec file on the host running docker daemon + use the plugin directly without creating a rootfs, ‘docker plugin create’, ‘docker plugin enable’ etc

My confusion was due to trying to ‘docker enable’ my plugin, those instructions really only apply to in-container plugins and so the question is whether this flavor of plugins support the tcp endpoint method ? The docs page seems to imply that only the unix method is supported for in-container plugins: https://docs.docker.com/engine/extend/#developing-a-plugin