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
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
Hey @sandeepkasargod, Thanks for the reply on this post. I have wasted almost 6-7 days trying to figure out how it works, had gone through every single line of docker enable code to see where is this fallback happening.
I tried the way you suggested. I created the server and ran it in docker container (I can run it outside the container as well). Mapped the ports from docker to localhost, so it is as good as running the container directly on the host.
I am still seeing this error:
docker: Error response from daemon: logger: no log driver named 'plugin_name' is registered.
Do you think I am doing something wrong? Do I need to perform any other steps as well other than bringing up the server and write the spec file.