@@ -55,7 +55,7 @@ enabled, and use it to create a volume.
5555
56561 . Install the ` sshfs ` plugin.
5757
58- ``` bash
58+ ``` console
5959 $ docker plugin install vieux/sshfs
6060
6161 Plugin "vieux/sshfs" is requesting the following privileges:
@@ -74,7 +74,7 @@ enabled, and use it to create a volume.
7474
75752. Check that the plugin is enabled in the output of `docker plugin ls`.
7676
77- ` ` ` bash
77+ ```console
7878 $ docker plugin ls
7979
8080 ID NAME TAG DESCRIPTION ENABLED
@@ -87,7 +87,7 @@ enabled, and use it to create a volume.
8787
8888 This volume can now be mounted into containers.
8989
90- ` ` ` bash
90+ ```console
9191 $ docker volume create \
9292 -d vieux/sshfs \
9393 --name sshvolume \
@@ -96,9 +96,10 @@ enabled, and use it to create a volume.
9696
9797 sshvolume
9898 ```
99+
991004. Verify that the volume was created successfully.
100101
101- ` ` ` bash
102+ ```console
102103 $ docker volume ls
103104
104105 DRIVER NAME
@@ -107,18 +108,19 @@ enabled, and use it to create a volume.
107108
1081095. Start a container that uses the volume `sshvolume`.
109110
110- ` ` ` bash
111+ ```console
111112 $ docker run --rm -v sshvolume:/data busybox ls /data
112113
113114 <content of /remote on machine 1.2.3.4>
114115 ```
115116
1161176. Remove the volume `sshvolume`
117- ` ` ` bash
118- docker volume rm sshvolume
118+ ```console
119+ $ docker volume rm sshvolume
119120
120121 sshvolume
121122 ```
123+
122124To disable a plugin, use the `docker plugin disable` command. To completely
123125remove it, use the `docker plugin remove` command. For other available
124126commands and options, see the
@@ -134,7 +136,7 @@ example, it was created from a Dockerfile:
134136>**Note:** The `/run/docker/plugins` directory is mandatory inside of the
135137plugin's filesystem for docker to communicate with the plugin.
136138
137- ```bash
139+ ```console
138140$ git clone https://github.com/vieux/docker-volume-sshfs
139141$ cd docker-volume-sshfs
140142$ docker build -t rootfsimage .
@@ -193,13 +195,13 @@ Stdout of a plugin is redirected to dockerd logs. Such entries have a
193195` f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62 ` and their
194196corresponding log entries in the docker daemon logs.
195197
196- ```bash
198+ ``` console
197199$ docker plugin install tiborvass/sample-volume-plugin
198200
199201INFO[0036] Starting... Found 0 volumes on startup plugin=f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62
200202```
201203
202- ```bash
204+ ``` console
203205$ docker volume create -d tiborvass/sample-volume-plugin samplevol
204206
205207INFO[0193] Create Called... Ensuring directory /data/samplevol exists on host... plugin=f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62
@@ -208,7 +210,7 @@ INFO[0193] Created volume samplevol with mountpoint /data/samp
208210INFO[0193] Path Called... Returned path /data/samplevol plugin=f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62
209211```
210212
211- ```bash
213+ ``` console
212214$ docker run -v samplevol:/tmp busybox sh
213215
214216INFO[0421] Get Called... Found samplevol plugin=f52a3df433b9aceee436eaada0752f5797aab1de47e5485f1690a073b860ff62
@@ -223,7 +225,7 @@ INFO[0421] Unmount Called... Unmounted samplevol plugin=f52a3df433b9a
223225plugins. This is specifically useful to collect plugin logs if they are
224226redirected to a file.
225227
226- ```bash
228+ ``` console
227229$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins list
228230
229231ID PID STATUS BUNDLE CREATED OWNER
@@ -232,13 +234,14 @@ ID PID S
232234c5bb4b90941efcaccca999439ed06d6a6affdde7081bb34dc84126b57b3e793d 14984 running /run/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby-plugins/c5bb4b90941efcaccca999439ed06d6a6affdde7081bb34dc84126b57b3e793d 2018-02-08T21:35:12.321288966Z root
233235```
234236
235- ```bash
237+ ``` console
236238$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins exec 93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 cat /var/log/plugin.log
237239```
238240
239241If the plugin has a built-in shell, then exec into the plugin can be done as
240242follows:
241- ```bash
243+
244+ ``` console
242245$ sudo docker-runc --root /var/run/docker/plugins/runtime-root/moby-plugins exec -t 93f1e7dbfe11c938782c2993628c895cf28e2274072c4a346a6002446c949b25 sh
243246```
244247
@@ -251,17 +254,18 @@ the plugin is listening on the said socket. For a well functioning plugin,
251254these basic requests should work. Note that plugin sockets are available on the host under ` /var/run/docker/plugins/<pluginID> `
252255
253256
254- ```bash
255- curl -H "Content-Type: application/json" -XPOST -d ' {}' --unix-socket /var/run/docker/plugins/e8a37ba56fc879c991f7d7921901723c64df6b42b87e6a0b055771ecf8477a6d/plugin.sock http:/VolumeDriver.List
257+ ``` console
258+ $ curl -H " Content-Type: application/json" -XPOST -d ' {}' --unix-socket /var/run/docker/plugins/e8a37ba56fc879c991f7d7921901723c64df6b42b87e6a0b055771ecf8477a6d/plugin.sock http:/VolumeDriver.List
256259
257260{"Mountpoint":"","Err":"","Volumes":[{"Name":"myvol1","Mountpoint":"/data/myvol1"},{"Name":"myvol2","Mountpoint":"/data/myvol2"}],"Volume":null}
258261```
259262
260- ```bash
261- curl -H "Content-Type: application/json" -XPOST -d ' {}' --unix-socket /var/run/docker/plugins/45e00a7ce6185d6e365904c8bcf62eb724b1fe307e0d4e7ecc9f6c1eb7bcdb70/plugin.sock http:/NetworkDriver.GetCapabilities
263+ ``` console
264+ $ curl -H " Content-Type: application/json" -XPOST -d ' {}' --unix-socket /var/run/docker/plugins/45e00a7ce6185d6e365904c8bcf62eb724b1fe307e0d4e7ecc9f6c1eb7bcdb70/plugin.sock http:/NetworkDriver.GetCapabilities
262265
263266{"Scope":"local"}
264267```
268+
265269When using curl 7.5 and above, the URL should be of the form
266270` http://hostname/APICall ` , where ` hostname ` is the valid hostname where the
267271plugin is installed and ` APICall ` is the call to the plugin API.
0 commit comments