mirror of https://github.com/docker/cli.git
fixed the plugin command docker-runc
Signed-off-by: Bishal Das <bishalhnj127@gmail.com>
(cherry picked from commit 3da9499e50
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
9fdeb9c3de
commit
75d7ce92a2
|
@ -14,9 +14,9 @@ keywords: "API, Usage, plugins, documentation, developer"
|
||||||
|
|
||||||
# Docker Engine managed plugin system
|
# Docker Engine managed plugin system
|
||||||
|
|
||||||
* [Installing and using a plugin](index.md#installing-and-using-a-plugin)
|
- [Installing and using a plugin](index.md#installing-and-using-a-plugin)
|
||||||
* [Developing a plugin](index.md#developing-a-plugin)
|
- [Developing a plugin](index.md#developing-a-plugin)
|
||||||
* [Debugging plugins](index.md#debugging-plugins)
|
- [Debugging plugins](index.md#debugging-plugins)
|
||||||
|
|
||||||
Docker Engine's plugin system allows you to install, start, stop, and remove
|
Docker Engine's plugin system allows you to install, start, stop, and remove
|
||||||
plugins using Docker Engine.
|
plugins using Docker Engine.
|
||||||
|
@ -70,7 +70,7 @@ enabled, and use it to create a volume.
|
||||||
|
|
||||||
- It needs access to the `host` network.
|
- It needs access to the `host` network.
|
||||||
- It needs the `CAP_SYS_ADMIN` capability, which allows the plugin to run
|
- It needs the `CAP_SYS_ADMIN` capability, which allows the plugin to run
|
||||||
the `mount` command.
|
the `mount` command.
|
||||||
|
|
||||||
2. Check that the plugin is enabled in the output of `docker plugin ls`.
|
2. Check that the plugin is enabled in the output of `docker plugin ls`.
|
||||||
|
|
||||||
|
@ -115,6 +115,7 @@ enabled, and use it to create a volume.
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Remove the volume `sshvolume`
|
6. Remove the volume `sshvolume`
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ docker volume rm sshvolume
|
$ docker volume rm sshvolume
|
||||||
|
|
||||||
|
@ -126,15 +127,15 @@ remove it, use the `docker plugin remove` command. For other available
|
||||||
commands and options, see the
|
commands and options, see the
|
||||||
[command line reference](https://docs.docker.com/engine/reference/commandline/cli/).
|
[command line reference](https://docs.docker.com/engine/reference/commandline/cli/).
|
||||||
|
|
||||||
|
|
||||||
## Developing a plugin
|
## Developing a plugin
|
||||||
|
|
||||||
#### The rootfs directory
|
#### The rootfs directory
|
||||||
|
|
||||||
The `rootfs` directory represents the root filesystem of the plugin. In this
|
The `rootfs` directory represents the root filesystem of the plugin. In this
|
||||||
example, it was created from a Dockerfile:
|
example, it was created from a Dockerfile:
|
||||||
|
|
||||||
>**Note:** The `/run/docker/plugins` directory is mandatory inside of the
|
> **Note:** The `/run/docker/plugins` directory is mandatory inside of the
|
||||||
plugin's filesystem for docker to communicate with the plugin.
|
> plugin's filesystem for docker to communicate with the plugin.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ git clone https://github.com/vieux/docker-volume-sshfs
|
$ git clone https://github.com/vieux/docker-volume-sshfs
|
||||||
|
@ -155,19 +156,19 @@ Consider the following `config.json` file.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"description": "sshFS plugin for Docker",
|
"description": "sshFS plugin for Docker",
|
||||||
"documentation": "https://docs.docker.com/engine/extend/plugins/",
|
"documentation": "https://docs.docker.com/engine/extend/plugins/",
|
||||||
"entrypoint": ["/docker-volume-sshfs"],
|
"entrypoint": ["/docker-volume-sshfs"],
|
||||||
"network": {
|
"network": {
|
||||||
"type": "host"
|
"type": "host"
|
||||||
},
|
},
|
||||||
"interface" : {
|
"interface": {
|
||||||
"types": ["docker.volumedriver/1.0"],
|
"types": ["docker.volumedriver/1.0"],
|
||||||
"socket": "sshfs.sock"
|
"socket": "sshfs.sock"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"capabilities": ["CAP_SYS_ADMIN"]
|
"capabilities": ["CAP_SYS_ADMIN"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -187,7 +188,6 @@ After that the plugin `<plugin-name>` will show up in `docker plugin ls`.
|
||||||
Plugins can be pushed to remote registries with
|
Plugins can be pushed to remote registries with
|
||||||
`docker plugin push <plugin-name>`.
|
`docker plugin push <plugin-name>`.
|
||||||
|
|
||||||
|
|
||||||
## Debugging plugins
|
## Debugging plugins
|
||||||
|
|
||||||
Stdout of a plugin is redirected to dockerd logs. Such entries have a
|
Stdout of a plugin is redirected to dockerd logs. Such entries have a
|
||||||
|
@ -226,7 +226,7 @@ plugins. This is specifically useful to collect plugin logs if they are
|
||||||
redirected to a file.
|
redirected to a file.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins list
|
$ sudo runc --root /run/docker/runtime-runc/plugins.moby list
|
||||||
|
|
||||||
ID PID STATUS BUNDLE CREATED OWNER
|
ID PID STATUS BUNDLE CREATED OWNER
|
||||||
93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 15806 running /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby-plugins/93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 2018-02-08T21:40:08.621358213Z root
|
93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 15806 running /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby-plugins/93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 2018-02-08T21:40:08.621358213Z root
|
||||||
|
@ -235,14 +235,14 @@ c5bb4b90941efcaccca999439ed06d6a6affdde7081bb34dc84126b57b3e793d 14984 r
|
||||||
```
|
```
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins exec 93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 cat /var/log/plugin.log
|
$ sudo runc --root /run/docker/runtime-runc/plugins.moby exec 93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 cat /var/log/plugin.log
|
||||||
```
|
```
|
||||||
|
|
||||||
If the plugin has a built-in shell, then exec into the plugin can be done as
|
If the plugin has a built-in shell, then exec into the plugin can be done as
|
||||||
follows:
|
follows:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins exec -t 93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 sh
|
$ sudo runc --root /run/docker/runtime-runc/plugins.moby exec -t 93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 sh
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Using curl to debug plugin socket issues.
|
#### Using curl to debug plugin socket issues.
|
||||||
|
@ -253,7 +253,6 @@ docker host to volume and network plugins using curl 7.47.0 to ensure that
|
||||||
the plugin is listening on the said socket. For a well functioning plugin,
|
the plugin is listening on the said socket. For a well functioning plugin,
|
||||||
these basic requests should work. Note that plugin sockets are available on the host under `/var/run/docker/plugins/<pluginID>`
|
these basic requests should work. Note that plugin sockets are available on the host under `/var/run/docker/plugins/<pluginID>`
|
||||||
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ curl -H "Content-Type: application/json" -XPOST -d '{}' --unix-socket /var/run/docker/plugins/e8a37ba56fc879c991f7d7921901723c64df6b42b87e6a0b055771ecf8477a6d/plugin.sock http:/VolumeDriver.List
|
$ curl -H "Content-Type: application/json" -XPOST -d '{}' --unix-socket /var/run/docker/plugins/e8a37ba56fc879c991f7d7921901723c64df6b42b87e6a0b055771ecf8477a6d/plugin.sock http:/VolumeDriver.List
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue