Lorenzo Fontana
Software Engineer at Facile.it
In Docker batteries are included
How?
Authorization
VolumeDriver
Network
IPAM
Wrap the Docker Remote API
Wrap the Docker Remote API
Wrap the Docker Remote API
Wrap the Docker Remote API
The plugin implements an HTTP server which can be discovered by Docker
The HTTP server exposes a set of RPCs issued as HTTP POSTs with JSON payloads
Docker makes a request to the plugin whenever is needed
Docker will always first check for unix sockets first (*.sock) by looking in the /run/docker/plugins folder
Then it will check for specifications files
like
*.spec
and
*.json
in
/etc/docker/plugins
or
/usr/lib/docker/plugins
/etc/docker/plugins/example-plugin.json
{
"Name": "example-plugin",
"Addr": "https://fntlnz.wtf/example-plugin",
"TLSConfig": {
"InsecureSkipVerify": false,
"CAFile": "/usr/shared/docker/certs/example-ca.pem",
"CertFile": "/usr/shared/docker/certs/example-cert.pem",
"KeyFile": "/usr/shared/docker/certs/example-key.pem",
}
}
/etc/docker/plugins/example-plugin.spec
tcp://[::]:8080
unix:///path/to/my/plugin.sock
POST /Plugin.Activate
Response:
{
"Implements": ["VolumeDriver"]
}
Available protocols are:
Each protocol provides its own set of RPC calls in addition to the activation call
Is done via the response error form
{
"Err": string
}
That should be used along with the HTTP error statuses 400 and 500
Plugins that provide volume capabilities must register themselves as VolumeDriver during the Handshake
{
"Implements": ["VolumeDriver"]
}
A VolumeDriver plugin is expected to provide writable paths on the host filesystem
A volume plugin makes use of the flags:
-v : to specify the volume name
--volume-driver : to specify the driver
docker run -ti \
-v volumename:/folder \
--volume-driver=myplugin \
alpine sh
/VolumeDriver.Create
/VolumeDriver.Remove
/VolumeDriver.Mount
/VolumeDriver.Path
/VolumeDriver.Unmount
/VolumeDriver.Get
/VolumeDriver.List
There's nothing from Docker that can help me implementing this?
hope that everything works as expected
Flocker:
https://clusterhq.com/docker-pluginGlusterFS plugin:
https://github.com/calavera/docker-volume-glusterfsIPFS plugin:
http://github.com/vdemeester/docker-volume-ipfsOpenStorage plugin:
https://github.com/libopenstorage/openstoragePlugins that provide network capabilities must register themself as NetworkDriver during the Handshake
{
"Implements": ["NetworkDriver"]
}
This indicates that the plugin should be registered with LibNetwork as driver
/NetworkDriver.CreateNetwork
/NetworkDriver.DeleteNetwork
/NetworkDriver.CreateEndpoint
/NetworkDriver.EndpointOperInfo
/NetworkDriver.DeleteEndpoint
/NetworkDriver.Join
/NetworkDriver.Leave
Weave:
https://github.com/weaveworks/weaveOnion:
https://github.com/jfrazelle/onionContiv Networking:
https://github.com/contiv/netplugin