Signed-off-by: Charles Smith <charles.smith@docker.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,272 @@ |
| 0 |
+<!--[metadata]> |
|
| 1 |
+aliases = [ |
|
| 2 |
+"/engine/extend/" |
|
| 3 |
+] |
|
| 4 |
+title = "Managed plugin system" |
|
| 5 |
+description = "How develop and use a plugin with the managed plugin system" |
|
| 6 |
+keywords = ["API, Usage, plugins, documentation, developer"] |
|
| 7 |
+advisory = "experimental" |
|
| 8 |
+[menu.main] |
|
| 9 |
+parent = "engine_extend" |
|
| 10 |
+weight=1 |
|
| 11 |
+<![end-metadata]--> |
|
| 12 |
+ |
|
| 13 |
+# Docker Engine managed plugin system |
|
| 14 |
+ |
|
| 15 |
+This document describes the plugin system available today in the **experimental |
|
| 16 |
+build** of Docker 1.12: |
|
| 17 |
+ |
|
| 18 |
+* [How to operate an existing plugin](#how-to-operate-a-plugin) |
|
| 19 |
+* [How to develop a plugin](#how-to-develop-a-plugin) |
|
| 20 |
+ |
|
| 21 |
+Unlike the legacy plugin system, you now manage plugins using Docker Engine: |
|
| 22 |
+ |
|
| 23 |
+* install plugins |
|
| 24 |
+* start plugins |
|
| 25 |
+* stop plugins |
|
| 26 |
+* remove plugins |
|
| 27 |
+ |
|
| 28 |
+The current Docker Engine plugin system only supports volume drivers. We are |
|
| 29 |
+adding more plugin driver types in the future releases. |
|
| 30 |
+ |
|
| 31 |
+For information on Docker Engine plugins generally available in Docker Engine |
|
| 32 |
+1.12 and earlier, refer to [Understand legacy Docker Engine plugins](legacy_plugins.md). |
|
| 33 |
+ |
|
| 34 |
+## How to operate a plugin |
|
| 35 |
+ |
|
| 36 |
+Plugins are distributed as Docker images, so develpers can host them on Docker |
|
| 37 |
+Hub or on a private registry. |
|
| 38 |
+ |
|
| 39 |
+You install the plugin using a single command: `docker plugin install <PLUGIN>`. |
|
| 40 |
+The `plugin install` command pulls the plugin from the Docker Hub or private |
|
| 41 |
+registry. If necessary the CLI prompts you to accept any privilige requriements. |
|
| 42 |
+For example the plugin may require access to a device on the host system. |
|
| 43 |
+Finally it enables the plugin. |
|
| 44 |
+ |
|
| 45 |
+Run `docker plugin ls` to check the status of installed plugins. The Engine |
|
| 46 |
+markes plugins that are started without issues as `ENABLED`. |
|
| 47 |
+ |
|
| 48 |
+After you install a plugin, the plugin behavior is the same as legacy plugins. |
|
| 49 |
+The following example demonstrates how to install the `sshfs` plugin and use it |
|
| 50 |
+to create a volume. |
|
| 51 |
+ |
|
| 52 |
+1. Install the `sshfs` plugin. |
|
| 53 |
+ |
|
| 54 |
+ ```bash |
|
| 55 |
+ $ docker plugin install vieux/sshfs |
|
| 56 |
+ |
|
| 57 |
+ Plugin "vieux/sshfs" is requesting the following privileges: |
|
| 58 |
+ - network: [host] |
|
| 59 |
+ - capabilities: [CAP_SYS_ADMIN] |
|
| 60 |
+ Do you grant the above permissions? [y/N] y |
|
| 61 |
+ |
|
| 62 |
+ vieux/sshfs |
|
| 63 |
+ ``` |
|
| 64 |
+ |
|
| 65 |
+ The plugin requests 2 privileges, the `CAP_SYS_ADMIN` capability to be able |
|
| 66 |
+ to do mount inside the plugin and `host networking`. |
|
| 67 |
+ |
|
| 68 |
+2. Check for a value of `true` the `ENABLED` column to verify the plugin |
|
| 69 |
+started without error. |
|
| 70 |
+ |
|
| 71 |
+ ```bash |
|
| 72 |
+ $ docker plugin ls |
|
| 73 |
+ |
|
| 74 |
+ NAME TAG ENABLED |
|
| 75 |
+ vieux/sshfs latest true |
|
| 76 |
+ ``` |
|
| 77 |
+ |
|
| 78 |
+3. Create a volume using the plugin. |
|
| 79 |
+ |
|
| 80 |
+ ```bash |
|
| 81 |
+ $ docker volume create \ |
|
| 82 |
+ -d vieux/sshfs \ |
|
| 83 |
+ --name sshvolume \ |
|
| 84 |
+ -o sshcmd=user@1.2.3.4:/remote |
|
| 85 |
+ |
|
| 86 |
+ sshvolume |
|
| 87 |
+ ``` |
|
| 88 |
+ |
|
| 89 |
+4. Use the volume `sshvolume`. |
|
| 90 |
+ |
|
| 91 |
+ ```bash |
|
| 92 |
+ $ docker run -v sshvolume:/data busybox ls /data |
|
| 93 |
+ |
|
| 94 |
+ <content of /remote on machine 1.2.3.4> |
|
| 95 |
+ ``` |
|
| 96 |
+ |
|
| 97 |
+5. Verify the plugin successfully created the volume. |
|
| 98 |
+ |
|
| 99 |
+ ```bash |
|
| 100 |
+ $ docker volume ls |
|
| 101 |
+ |
|
| 102 |
+ DRIVER NAME |
|
| 103 |
+ vieux/sshfs sshvolume |
|
| 104 |
+ ``` |
|
| 105 |
+ |
|
| 106 |
+ You can stop a plugin with the `docker plugin disable` |
|
| 107 |
+ command or remove a plugin with `docker plugin remove`. |
|
| 108 |
+ |
|
| 109 |
+See the [command line reference](../reference/commandline/index.md) for more |
|
| 110 |
+information. |
|
| 111 |
+ |
|
| 112 |
+## How to develop a plugin |
|
| 113 |
+ |
|
| 114 |
+Plugin creation is currently a manual process. We plan to add automation in a |
|
| 115 |
+future release with a command such as `docker plugin build`. |
|
| 116 |
+ |
|
| 117 |
+This section describes the format of an existing enabled plugin. You have to |
|
| 118 |
+create and format the plugin files by hand. |
|
| 119 |
+ |
|
| 120 |
+Plugins are stored in `/var/lib/docker/plugins`. For instance: |
|
| 121 |
+ |
|
| 122 |
+```bash |
|
| 123 |
+# ls -la /var/lib/docker/plugins |
|
| 124 |
+total 20 |
|
| 125 |
+drwx------ 4 root root 4096 Aug 8 18:03 . |
|
| 126 |
+drwx--x--x 12 root root 4096 Aug 8 17:53 .. |
|
| 127 |
+drwxr-xr-x 3 root root 4096 Aug 8 17:56 cd851ce43a403 |
|
| 128 |
+-rw------- 1 root root 2107 Aug 8 18:03 plugins.json |
|
| 129 |
+``` |
|
| 130 |
+ |
|
| 131 |
+`plugins.json` is an inventory of all installed plugins. For example: |
|
| 132 |
+ |
|
| 133 |
+```bash |
|
| 134 |
+# cat plugins.json |
|
| 135 |
+{
|
|
| 136 |
+ "cd851ce43a403": {
|
|
| 137 |
+ "plugin": {
|
|
| 138 |
+ "Manifest": {
|
|
| 139 |
+ "Args": {
|
|
| 140 |
+ "Value": null, |
|
| 141 |
+ "Settable": null, |
|
| 142 |
+ "Description": "", |
|
| 143 |
+ "Name": "" |
|
| 144 |
+ }, |
|
| 145 |
+ "Env": null, |
|
| 146 |
+ "Devices": null, |
|
| 147 |
+ "Mounts": null, |
|
| 148 |
+ "Capabilities": [ |
|
| 149 |
+ "CAP_SYS_ADMIN" |
|
| 150 |
+ ], |
|
| 151 |
+ "ManifestVersion": "v0.1", |
|
| 152 |
+ "Description": "sshFS plugin for Docker", |
|
| 153 |
+ "Documentation": "https://docs.docker.com/engine/extend/plugins/", |
|
| 154 |
+ "Interface": {
|
|
| 155 |
+ "Socket": "sshfs.sock", |
|
| 156 |
+ "Types": [ |
|
| 157 |
+ "docker.volumedriver/1.0" |
|
| 158 |
+ ] |
|
| 159 |
+ }, |
|
| 160 |
+ "Entrypoint": [ |
|
| 161 |
+ "/go/bin/docker-volume-sshfs" |
|
| 162 |
+ ], |
|
| 163 |
+ "Workdir": "", |
|
| 164 |
+ "User": {},
|
|
| 165 |
+ "Network": {
|
|
| 166 |
+ "Type": "host" |
|
| 167 |
+ } |
|
| 168 |
+ }, |
|
| 169 |
+ "Config": {
|
|
| 170 |
+ "Devices": null, |
|
| 171 |
+ "Args": null, |
|
| 172 |
+ "Env": [], |
|
| 173 |
+ "Mounts": [] |
|
| 174 |
+ }, |
|
| 175 |
+ "Active": true, |
|
| 176 |
+ "Tag": "latest", |
|
| 177 |
+ "Name": "vieux/sshfs", |
|
| 178 |
+ "Id": "cd851ce43a403" |
|
| 179 |
+ } |
|
| 180 |
+ } |
|
| 181 |
+} |
|
| 182 |
+``` |
|
| 183 |
+ |
|
| 184 |
+Each folder represents a plugin. For example: |
|
| 185 |
+ |
|
| 186 |
+```bash |
|
| 187 |
+# ls -la /var/lib/docker/plugins/cd851ce43a403 |
|
| 188 |
+total 12 |
|
| 189 |
+drwx------ 19 root root 4096 Aug 8 17:56 rootfs |
|
| 190 |
+-rw-r--r-- 1 root root 50 Aug 8 17:56 plugin-config.json |
|
| 191 |
+-rw------- 1 root root 347 Aug 8 17:56 manifest.json |
|
| 192 |
+``` |
|
| 193 |
+ |
|
| 194 |
+`rootfs` represents the root filesystem of the plugin. In this example, it was |
|
| 195 |
+created from a Dockerfile as follows: |
|
| 196 |
+ |
|
| 197 |
+>**Note:** `/run/docker/plugins` is mandatory for docker to communicate with |
|
| 198 |
+the plugin._ |
|
| 199 |
+ |
|
| 200 |
+```bash |
|
| 201 |
+$ git clone https://github.com/vieux/docker-volume-sshfs |
|
| 202 |
+$ cd docker-volume-sshfs |
|
| 203 |
+$ docker build -t rootfs . |
|
| 204 |
+$ id=$(docker create rootfs true) # id was cd851ce43a403 when the image was created |
|
| 205 |
+$ mkdir -p /var/lib/docker/plugins/$id/rootfs |
|
| 206 |
+$ docker export "$id" | tar -x -C /var/lib/docker/plugins/$id/rootfs |
|
| 207 |
+$ docker rm -vf "$id" |
|
| 208 |
+$ docker rmi rootfs |
|
| 209 |
+``` |
|
| 210 |
+ |
|
| 211 |
+`manifest.json` describes the plugin and `plugin-config.json` contains some |
|
| 212 |
+runtime parameters. For example: |
|
| 213 |
+ |
|
| 214 |
+```bash |
|
| 215 |
+# cat manifest.json |
|
| 216 |
+{
|
|
| 217 |
+ "manifestVersion": "v0.1", |
|
| 218 |
+ "description": "sshFS plugin for Docker", |
|
| 219 |
+ "documentation": "https://docs.docker.com/engine/extend/plugins/", |
|
| 220 |
+ "entrypoint": ["/go/bin/docker-volume-sshfs"], |
|
| 221 |
+ "network": {
|
|
| 222 |
+ "type": "host" |
|
| 223 |
+ }, |
|
| 224 |
+ "interface" : {
|
|
| 225 |
+ "types": ["docker.volumedriver/1.0"], |
|
| 226 |
+ "socket": "sshfs.sock" |
|
| 227 |
+ }, |
|
| 228 |
+ "capabilities": ["CAP_SYS_ADMIN"] |
|
| 229 |
+} |
|
| 230 |
+``` |
|
| 231 |
+ |
|
| 232 |
+In this example, you can see the plugin is a volume driver, requires the |
|
| 233 |
+`CAP_SYS_ADMIN` capability, `host networking`, `/go/bin/docker-volume-sshfs` as |
|
| 234 |
+entrypoint and is going to use `/run/docker/plugins/sshfs.sock` to communicate |
|
| 235 |
+with the Docker Engine. |
|
| 236 |
+ |
|
| 237 |
+```bash |
|
| 238 |
+# cat plugin-config.json |
|
| 239 |
+{
|
|
| 240 |
+ "Devices": null, |
|
| 241 |
+ "Args": null, |
|
| 242 |
+ "Env": [], |
|
| 243 |
+ "Mounts": [] |
|
| 244 |
+} |
|
| 245 |
+``` |
|
| 246 |
+ |
|
| 247 |
+This plugin doesn't require runtime parameters. |
|
| 248 |
+ |
|
| 249 |
+Both `manifest.json` and `plugin-config.json` are part of the `plugins.json`. |
|
| 250 |
+`manifest.json` is read-only and `plugin-config.json` is read-write. |
|
| 251 |
+ |
|
| 252 |
+To summarize, follow the steps below to create a plugin: |
|
| 253 |
+ |
|
| 254 |
+0. Choose a name for the plugin. Plugin name uses the same format as images, |
|
| 255 |
+for example: `<repo_name>/<name>`. |
|
| 256 |
+1. Create a rootfs in `/var/lib/docker/plugins/$id/rootfs`. |
|
| 257 |
+2. Create manifest.json file in `/var/lib/docker/plugins/$id/`. |
|
| 258 |
+3. Create a `plugin-config.json` if needed. |
|
| 259 |
+4. Create or add a section to `/var/lib/docker/plugins/plugins.json`. Use |
|
| 260 |
+ `<user>/<name>` as “Name” and `$id` as “Id”. |
|
| 261 |
+5. Restart the Docker Engine. |
|
| 262 |
+6. Run `docker plugin ls`. |
|
| 263 |
+ * If your plugin is listed as `ENABLED=true`, you can push it to the |
|
| 264 |
+ registry. |
|
| 265 |
+ * If the plugin is not listed or if `ENABLED=false`, something went wrong. |
|
| 266 |
+ Check the daemon logs for errors. |
|
| 267 |
+7. If you are not already logged in, use `docker login` to authenticate against |
|
| 268 |
+ a registry. |
|
| 269 |
+8. Run `docker plugin push <repo_name>/<name>` to push the plugin. |
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 |
-title = "Extending Engine with plugins" |
|
| 3 |
+aliases = "/engine/extend/plugins/" |
|
| 4 |
+title = "Use Docker Engine plugins" |
|
| 4 | 5 |
description = "How to add additional functionality to Docker with plugins extensions" |
| 5 | 6 |
keywords = ["Examples, Usage, plugins, docker, documentation, user guide"] |
| 6 | 7 |
[menu.main] |
| ... | ... |
@@ -9,11 +10,11 @@ weight=3 |
| 9 | 9 |
+++ |
| 10 | 10 |
<![end-metadata]--> |
| 11 | 11 |
|
| 12 |
-# Understand legacy Docker Engine plugins |
|
| 12 |
+# Use Docker Engine plugins |
|
| 13 | 13 |
|
| 14 | 14 |
This document describes the Docker Engine plugins generally available in Docker |
| 15 |
-Engine 1.12 and earlier. To view information on plugins managed by Docker |
|
| 16 |
-Engine, refer to [Docker Engine plugin system](plugins.md). |
|
| 15 |
+Engine. To view information on plugins managed by Docker Engine currently in |
|
| 16 |
+experimental status, refer to [Docker Engine plugin system](index.md). |
|
| 17 | 17 |
|
| 18 | 18 |
You can extend the capabilities of the Docker Engine by loading third-party |
| 19 | 19 |
plugins. This page explains the types of plugins and provides links to several |
| ... | ... |
@@ -21,7 +22,7 @@ volume and network plugins for Docker. |
| 21 | 21 |
|
| 22 | 22 |
## Types of plugins |
| 23 | 23 |
|
| 24 |
-Plugins extend Docker's functionality. They come in specific types. For |
|
| 24 |
+Plugins extend Docker's functionality. They come in specific types. For |
|
| 25 | 25 |
example, a [volume plugin](plugins_volume.md) might enable Docker |
| 26 | 26 |
volumes to persist across multiple Docker hosts and a |
| 27 | 27 |
[network plugin](plugins_network.md) might provide network plumbing. |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
<!--[metadata]> |
| 2 | 2 |
+++ |
| 3 |
-title = "Extend Docker" |
|
| 4 |
-description = "How to extend Docker Engine with plugins" |
|
| 3 |
+title = "Implement plugins" |
|
| 4 |
+description = "Develop plugins and use existing plugins for Docker Engine" |
|
| 5 | 5 |
keywords = ["extend, plugins, docker, documentation, developer"] |
| 6 | 6 |
type="menu" |
| 7 | 7 |
[menu.main] |
| ... | ... |
@@ -12,9 +12,4 @@ weight = 0 |
| 12 | 12 |
<![end-metadata]--> |
| 13 | 13 |
|
| 14 | 14 |
|
| 15 |
-## New Docker Plugin System |
|
| 16 |
- |
|
| 17 |
-Currently, you can extend Docker Engine by adding a plugin. This section contains the following topics: |
|
| 18 |
- |
|
| 19 |
-* [Understand Docker plugins](plugins.md) |
|
| 20 |
-* [Write a volume plugin](plugins_volume.md) |
|
| 15 |
+<!--menu page not rendered--> |
| ... | ... |
@@ -14,9 +14,9 @@ weight=7 |
| 14 | 14 |
Docker plugins are out-of-process extensions which add capabilities to the |
| 15 | 15 |
Docker Engine. |
| 16 | 16 |
|
| 17 |
-This document describes the Docker Engine plugin API generally available in |
|
| 18 |
-Docker Engine 1.12 and earlier. To view information on plugins managed by Docker |
|
| 19 |
-Engine, refer to [Docker Engine plugin system](plugins.md). |
|
| 17 |
+This document describes the Docker Engine plugin API. To view information on |
|
| 18 |
+plugins managed by Docker Engine currently in experimental status, refer to |
|
| 19 |
+[Docker Engine plugin system](index.md). |
|
| 20 | 20 |
|
| 21 | 21 |
This page is intended for people who want to develop their own Docker plugin. |
| 22 | 22 |
If you just want to learn about or use Docker plugins, look |
| 23 | 23 |
deleted file mode 100644 |
| ... | ... |
@@ -1,272 +0,0 @@ |
| 1 |
-<!--[metadata]> |
|
| 2 |
-+++ |
|
| 3 |
-aliases = [ |
|
| 4 |
-"/engine/extend/" |
|
| 5 |
-] |
|
| 6 |
-title = "New Plugin System" |
|
| 7 |
-description = "How to operate and create a plugin with the new system" |
|
| 8 |
-keywords = ["API, Usage, plugins, documentation, developer"] |
|
| 9 |
-advisory = "experimental" |
|
| 10 |
-[menu.main] |
|
| 11 |
-parent = "engine_extend" |
|
| 12 |
-weight=1 |
|
| 13 |
-+++ |
|
| 14 |
-<![end-metadata]--> |
|
| 15 |
- |
|
| 16 |
-# Docker Engine plugin system |
|
| 17 |
- |
|
| 18 |
-This document describes the plugin system available today in the **experimental |
|
| 19 |
-build** of Docker 1.12: |
|
| 20 |
- |
|
| 21 |
-* [How to operate an existing plugin](#how-to-operate-a-plugin) |
|
| 22 |
-* [How to develop a plugin](#how-to-develop-a-plugin) |
|
| 23 |
- |
|
| 24 |
-Unlike the legacy plugin system, you now manage plugins using Docker Engine: |
|
| 25 |
- |
|
| 26 |
-* install plugins |
|
| 27 |
-* start plugins |
|
| 28 |
-* stop plugins |
|
| 29 |
-* remove plugins |
|
| 30 |
- |
|
| 31 |
-The current Docker Engine plugin system only supports volume drivers. We are |
|
| 32 |
-adding more plugin driver types in the future releases. |
|
| 33 |
- |
|
| 34 |
-For information on Docker Engine plugins generally available in Docker Engine |
|
| 35 |
-1.12 and earlier, refer to [Understand legacy Docker Engine plugins](legacy_plugins.md). |
|
| 36 |
- |
|
| 37 |
-## How to operate a plugin |
|
| 38 |
- |
|
| 39 |
-Plugins are distributed as Docker images, so develpers can host them on Docker |
|
| 40 |
-Hub or on a private registry. |
|
| 41 |
- |
|
| 42 |
-You install the plugin using a single command: `docker plugin install <PLUGIN>`. |
|
| 43 |
-The `plugin install` command pulls the plugin from the Docker Hub or private |
|
| 44 |
-registry. If necessary the CLI prompts you to accept any privilige requriements. |
|
| 45 |
-For example the plugin may require access to a device on the host system. |
|
| 46 |
-Finally it enables the plugin. |
|
| 47 |
- |
|
| 48 |
-Run `docker plugin ls` to check the status of installed plugins. The Engine |
|
| 49 |
-markes plugins that are started without issues as `ENABLED`. |
|
| 50 |
- |
|
| 51 |
-After you install a plugin, the plugin behavior is the same as legacy plugins. |
|
| 52 |
-The following example demonstrates how to install the `sshfs` plugin and use it |
|
| 53 |
-to create a volume. |
|
| 54 |
- |
|
| 55 |
-1. Install the `sshfs` plugin. |
|
| 56 |
- |
|
| 57 |
- ```bash |
|
| 58 |
- $ docker plugin install vieux/sshfs |
|
| 59 |
- |
|
| 60 |
- Plugin "vieux/sshfs" is requesting the following privileges: |
|
| 61 |
- - network: [host] |
|
| 62 |
- - capabilities: [CAP_SYS_ADMIN] |
|
| 63 |
- Do you grant the above permissions? [y/N] y |
|
| 64 |
- |
|
| 65 |
- vieux/sshfs |
|
| 66 |
- ``` |
|
| 67 |
- |
|
| 68 |
- The plugin requests 2 privileges, the `CAP_SYS_ADMIN` capability to be able |
|
| 69 |
- to do mount inside the plugin and `host networking`. |
|
| 70 |
- |
|
| 71 |
-2. Check for a value of `true` the `ENABLED` column to verify the plugin |
|
| 72 |
-started without error. |
|
| 73 |
- |
|
| 74 |
- ```bash |
|
| 75 |
- $ docker plugin ls |
|
| 76 |
- |
|
| 77 |
- NAME TAG ENABLED |
|
| 78 |
- vieux/sshfs latest true |
|
| 79 |
- ``` |
|
| 80 |
- |
|
| 81 |
-3. Create a volume using the plugin. |
|
| 82 |
- |
|
| 83 |
- ```bash |
|
| 84 |
- $ docker volume create \ |
|
| 85 |
- -d vieux/sshfs \ |
|
| 86 |
- --name sshvolume \ |
|
| 87 |
- -o sshcmd=user@1.2.3.4:/remote |
|
| 88 |
- |
|
| 89 |
- sshvolume |
|
| 90 |
- ``` |
|
| 91 |
- |
|
| 92 |
-4. Use the volume `sshvolume`. |
|
| 93 |
- |
|
| 94 |
- ```bash |
|
| 95 |
- $ docker run -v sshvolume:/data busybox ls /data |
|
| 96 |
- |
|
| 97 |
- <content of /remote on machine 1.2.3.4> |
|
| 98 |
- ``` |
|
| 99 |
- |
|
| 100 |
-5. Verify the plugin successfully created the volume. |
|
| 101 |
- |
|
| 102 |
- ```bash |
|
| 103 |
- $ docker volume ls |
|
| 104 |
- |
|
| 105 |
- DRIVER NAME |
|
| 106 |
- vieux/sshfs sshvolume |
|
| 107 |
- ``` |
|
| 108 |
- |
|
| 109 |
- You can stop a plugin with the `docker plugin disable` |
|
| 110 |
- command or remove a plugin with `docker plugin remove`. |
|
| 111 |
- |
|
| 112 |
-See the [command line reference](../reference/commandline/index.md) for more |
|
| 113 |
-information. |
|
| 114 |
- |
|
| 115 |
-## How to develop a plugin |
|
| 116 |
- |
|
| 117 |
-Plugin creation is currently a manual process. We plan to add automation in a |
|
| 118 |
-future release with a command such as `docker plugin build`. |
|
| 119 |
- |
|
| 120 |
-This section describes the format of an existing enabled plugin. You have to |
|
| 121 |
-create and format the plugin files by hand. |
|
| 122 |
- |
|
| 123 |
-Plugins are stored in `/var/lib/docker/plugins`. For instance: |
|
| 124 |
- |
|
| 125 |
-```bash |
|
| 126 |
-# ls -la /var/lib/docker/plugins |
|
| 127 |
-total 20 |
|
| 128 |
-drwx------ 4 root root 4096 Aug 8 18:03 . |
|
| 129 |
-drwx--x--x 12 root root 4096 Aug 8 17:53 .. |
|
| 130 |
-drwxr-xr-x 3 root root 4096 Aug 8 17:56 cd851ce43a403 |
|
| 131 |
--rw------- 1 root root 2107 Aug 8 18:03 plugins.json |
|
| 132 |
-``` |
|
| 133 |
- |
|
| 134 |
-`plugins.json` is an inventory of all installed plugins. For example: |
|
| 135 |
- |
|
| 136 |
-```bash |
|
| 137 |
-# cat plugins.json |
|
| 138 |
-{
|
|
| 139 |
- "cd851ce43a403": {
|
|
| 140 |
- "plugin": {
|
|
| 141 |
- "Manifest": {
|
|
| 142 |
- "Args": {
|
|
| 143 |
- "Value": null, |
|
| 144 |
- "Settable": null, |
|
| 145 |
- "Description": "", |
|
| 146 |
- "Name": "" |
|
| 147 |
- }, |
|
| 148 |
- "Env": null, |
|
| 149 |
- "Devices": null, |
|
| 150 |
- "Mounts": null, |
|
| 151 |
- "Capabilities": [ |
|
| 152 |
- "CAP_SYS_ADMIN" |
|
| 153 |
- ], |
|
| 154 |
- "ManifestVersion": "v0.1", |
|
| 155 |
- "Description": "sshFS plugin for Docker", |
|
| 156 |
- "Documentation": "https://docs.docker.com/engine/extend/plugins/", |
|
| 157 |
- "Interface": {
|
|
| 158 |
- "Socket": "sshfs.sock", |
|
| 159 |
- "Types": [ |
|
| 160 |
- "docker.volumedriver/1.0" |
|
| 161 |
- ] |
|
| 162 |
- }, |
|
| 163 |
- "Entrypoint": [ |
|
| 164 |
- "/go/bin/docker-volume-sshfs" |
|
| 165 |
- ], |
|
| 166 |
- "Workdir": "", |
|
| 167 |
- "User": {},
|
|
| 168 |
- "Network": {
|
|
| 169 |
- "Type": "host" |
|
| 170 |
- } |
|
| 171 |
- }, |
|
| 172 |
- "Config": {
|
|
| 173 |
- "Devices": null, |
|
| 174 |
- "Args": null, |
|
| 175 |
- "Env": [], |
|
| 176 |
- "Mounts": [] |
|
| 177 |
- }, |
|
| 178 |
- "Active": true, |
|
| 179 |
- "Tag": "latest", |
|
| 180 |
- "Name": "vieux/sshfs", |
|
| 181 |
- "Id": "cd851ce43a403" |
|
| 182 |
- } |
|
| 183 |
- } |
|
| 184 |
-} |
|
| 185 |
-``` |
|
| 186 |
- |
|
| 187 |
-Each folder represents a plugin. For example: |
|
| 188 |
- |
|
| 189 |
-```bash |
|
| 190 |
-# ls -la /var/lib/docker/plugins/cd851ce43a403 |
|
| 191 |
-total 12 |
|
| 192 |
-drwx------ 19 root root 4096 Aug 8 17:56 rootfs |
|
| 193 |
--rw-r--r-- 1 root root 50 Aug 8 17:56 plugin-config.json |
|
| 194 |
--rw------- 1 root root 347 Aug 8 17:56 manifest.json |
|
| 195 |
-``` |
|
| 196 |
- |
|
| 197 |
-`rootfs` represents the root filesystem of the plugin. In this example, it was |
|
| 198 |
-created from a Dockerfile as follows: |
|
| 199 |
- |
|
| 200 |
->**Note:** `/run/docker/plugins` is mandatory for docker to communicate with |
|
| 201 |
-the plugin._ |
|
| 202 |
- |
|
| 203 |
-```bash |
|
| 204 |
-$ git clone https://github.com/vieux/docker-volume-sshfs |
|
| 205 |
-$ cd docker-volume-sshfs |
|
| 206 |
-$ docker build -t rootfs . |
|
| 207 |
-$ id=$(docker create rootfs true) # id was cd851ce43a403 when the image was created |
|
| 208 |
-$ mkdir -p /var/lib/docker/plugins/$id/rootfs |
|
| 209 |
-$ docker export "$id" | tar -x -C /var/lib/docker/plugins/$id/rootfs |
|
| 210 |
-$ docker rm -vf "$id" |
|
| 211 |
-$ docker rmi rootfs |
|
| 212 |
-``` |
|
| 213 |
- |
|
| 214 |
-`manifest.json` describes the plugin and `plugin-config.json` contains some |
|
| 215 |
-runtime parameters. For example: |
|
| 216 |
- |
|
| 217 |
-```bash |
|
| 218 |
-# cat manifest.json |
|
| 219 |
-{
|
|
| 220 |
- "manifestVersion": "v0.1", |
|
| 221 |
- "description": "sshFS plugin for Docker", |
|
| 222 |
- "documentation": "https://docs.docker.com/engine/extend/plugins/", |
|
| 223 |
- "entrypoint": ["/go/bin/docker-volume-sshfs"], |
|
| 224 |
- "network": {
|
|
| 225 |
- "type": "host" |
|
| 226 |
- }, |
|
| 227 |
- "interface" : {
|
|
| 228 |
- "types": ["docker.volumedriver/1.0"], |
|
| 229 |
- "socket": "sshfs.sock" |
|
| 230 |
- }, |
|
| 231 |
- "capabilities": ["CAP_SYS_ADMIN"] |
|
| 232 |
-} |
|
| 233 |
-``` |
|
| 234 |
- |
|
| 235 |
-In this example, you can see the plugin is a volume driver, requires the |
|
| 236 |
-`CAP_SYS_ADMIN` capability, `host networking`, `/go/bin/docker-volume-sshfs` as |
|
| 237 |
-entrypoint and is going to use `/run/docker/plugins/sshfs.sock` to communicate |
|
| 238 |
-with the Docker Engine. |
|
| 239 |
- |
|
| 240 |
-```bash |
|
| 241 |
-# cat plugin-config.json |
|
| 242 |
-{
|
|
| 243 |
- "Devices": null, |
|
| 244 |
- "Args": null, |
|
| 245 |
- "Env": [], |
|
| 246 |
- "Mounts": [] |
|
| 247 |
-} |
|
| 248 |
-``` |
|
| 249 |
- |
|
| 250 |
-This plugin doesn't require runtime parameters. |
|
| 251 |
- |
|
| 252 |
-Both `manifest.json` and `plugin-config.json` are part of the `plugins.json`. |
|
| 253 |
-`manifest.json` is read-only and `plugin-config.json` is read-write. |
|
| 254 |
- |
|
| 255 |
-To summarize, follow the steps below to create a plugin: |
|
| 256 |
- |
|
| 257 |
-0. Choose a name for the plugin. Plugin name uses the same format as images, |
|
| 258 |
-for example: `<repo_name>/<name>`. |
|
| 259 |
-1. Create a rootfs in `/var/lib/docker/plugins/$id/rootfs`. |
|
| 260 |
-2. Create manifest.json file in `/var/lib/docker/plugins/$id/`. |
|
| 261 |
-3. Create a `plugin-config.json` if needed. |
|
| 262 |
-4. Create or add a section to `/var/lib/docker/plugins/plugins.json`. Use |
|
| 263 |
- `<user>/<name>` as “Name” and `$id` as “Id”. |
|
| 264 |
-5. Restart the Docker Engine. |
|
| 265 |
-6. Run `docker plugin ls`. |
|
| 266 |
- * If your plugin is listed as `ENABLED=true`, you can push it to the |
|
| 267 |
- registry. |
|
| 268 |
- * If the plugin is not listed or if `ENABLED=false`, something went wrong. |
|
| 269 |
- Check the daemon logs for errors. |
|
| 270 |
-7. If you are not already logged in, use `docker login` to authenticate against |
|
| 271 |
- a registry. |
|
| 272 |
-8. Run `docker plugin push <repo_name>/<name>` to push the plugin. |
| ... | ... |
@@ -13,9 +13,9 @@ weight = 4 |
| 13 | 13 |
|
| 14 | 14 |
# Create an authorization plugin |
| 15 | 15 |
|
| 16 |
-This document describes Docker Engine authorization plugins generally |
|
| 17 |
-available in Docker Engine 1.12 and earlier. To view information on plugins |
|
| 18 |
-managed by Docker Engine, refer to [Docker Engine plugin system](plugins.md). |
|
| 16 |
+This document describes the Docker Engine plugins generally available in Docker |
|
| 17 |
+Engine. To view information on plugins managed by Docker Engine currently in |
|
| 18 |
+experimental status, refer to [Docker Engine plugin system](index.md). |
|
| 19 | 19 |
|
| 20 | 20 |
Docker's out-of-the-box authorization model is all or nothing. Any user with |
| 21 | 21 |
permission to access the Docker daemon can run any Docker client command. The |
| ... | ... |
@@ -12,8 +12,8 @@ weight=5 |
| 12 | 12 |
# Engine network driver plugins |
| 13 | 13 |
|
| 14 | 14 |
This document describes Docker Engine network driver plugins generally |
| 15 |
-available in Docker Engine 1.12 and earlier. To view information on plugins |
|
| 16 |
-managed by Docker Engine, refer to [Docker Engine plugin system](plugins.md). |
|
| 15 |
+available in Docker Engine. To view information on plugins |
|
| 16 |
+managed by Docker Engine, refer to [Docker Engine plugin system](index.md). |
|
| 17 | 17 |
|
| 18 | 18 |
Docker Engine network plugins enable Engine deployments to be extended to |
| 19 | 19 |
support a wide range of networking technologies, such as VXLAN, IPVLAN, MACVLAN |
| ... | ... |
@@ -46,7 +46,7 @@ commands. For example, |
| 46 | 46 |
|
| 47 | 47 |
$ docker network create --driver weave mynet |
| 48 | 48 |
|
| 49 |
-Some network driver plugins are listed in [plugins](plugins.md) |
|
| 49 |
+Some network driver plugins are listed in [plugins](legacy_plugins.md) |
|
| 50 | 50 |
|
| 51 | 51 |
The `mynet` network is now owned by `weave`, so subsequent commands |
| 52 | 52 |
referring to that network will be sent to the plugin, |
| ... | ... |
@@ -13,8 +13,8 @@ weight=6 |
| 13 | 13 |
|
| 14 | 14 |
Docker Engine volume plugins enable Engine deployments to be integrated with |
| 15 | 15 |
external storage systems, such as Amazon EBS, and enable data volumes to persist |
| 16 |
-beyond the lifetime of a single Engine host. See the [plugin |
|
| 17 |
-documentation](plugins.md) for more information. |
|
| 16 |
+beyond the lifetime of a single Engine host. See the |
|
| 17 |
+[plugin documentation](legacy_plugins.md) for more information. |
|
| 18 | 18 |
|
| 19 | 19 |
## Changelog |
| 20 | 20 |
|
| ... | ... |
@@ -537,7 +537,7 @@ built-in network drivers. For example: |
| 537 | 537 |
You can inspect it, add containers to and from it, and so forth. Of course, |
| 538 | 538 |
different plugins may make use of different technologies or frameworks. Custom |
| 539 | 539 |
networks can include features not present in Docker's default networks. For more |
| 540 |
-information on writing plugins, see [Extending Docker](../../extend/plugins.md) and |
|
| 540 |
+information on writing plugins, see [Extending Docker](../../extend/legacy_plugins.md) and |
|
| 541 | 541 |
[Writing a network driver plugin](../../extend/plugins_network.md). |
| 542 | 542 |
|
| 543 | 543 |
### Docker embedded DNS server |