Merge pull request #493 from jmaitrehenry/patch-1

Change sshfs by cloudstor on Installing and using a plugin
This commit is contained in:
Misty Stanley-Jones 2017-09-06 14:42:34 -07:00 committed by GitHub
commit af94015b8c
1 changed files with 38 additions and 27 deletions

View File

@ -43,37 +43,49 @@ Plugins that start successfully are listed as enabled in the output.
After a plugin is installed, you can use it as an option for another Docker After a plugin is installed, you can use it as an option for another Docker
operation, such as creating a volume. operation, such as creating a volume.
In the following example, you install the `sshfs` plugin, verify that it is In the following example, you install the `docker4x/cloudstor` plugin, verify that it is
enabled, and use it to create a volume. enabled, and use it to create a volume.
> **Note**: This example is intended for instructional purposes only. Once the volume is created, your SSH password to the remote host will be exposed as plaintext when inspecting the volume. You should delete the volume as soon as you are done with the example.
1. Install the `sshfs` plugin. 1. Install the `sshfs` plugin.
```bash ```bash
$ docker plugin install vieux/sshfs $ docker plugin install docker4x/cloudstor:17.05.0-ce-azure2 \
--alias cloudstor:azure \
CLOUD_PLATFORM=AZURE \
AZURE_STORAGE_ACCOUNT_KEY="mmpwuGgnSKHodND...." \
AZURE_STORAGE_ACCOUNT="myswarmstorage"
Plugin "vieux/sshfs" is requesting the following privileges: Plugin "docker4x/cloudstor:17.06.0-ce-azure2" is requesting the following privileges:
- network: [host] - network: [host]
- capabilities: [CAP_SYS_ADMIN] - mount: [/dev]
- allow-all-devices: [true]
services:
- capabilities: [CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH]
Do you grant the above permissions? [y/N] y Do you grant the above permissions? [y/N] y
17.06.0-ce-azure2: Pulling from docker4x/cloudstor
vieux/sshfs 68b66459b745: Verifying Checksum
68b66459b745: Download complete
Digest: sha256:aa2ae6026e8f5c84d3992e239ec7eec2c578090f10528a51bd8c311d5da48c7a
Status: Downloaded newer image for docker4x/cloudstor:17.05.0-ce-azure2
Installed plugin docker4x/cloudstor:17.06.0-ce-azure2
``` ```
The plugin requests 2 privileges: The plugin requests 4 privileges:
- 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 access to the `/dev` mount.
   - It needs access to `allow-all-devices`.
   - It needs the `CAP_SYS_ADMIN` capability, which allows the plugin to run
the `mount` command. the `mount` command.
   - It needs the `CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH`capabilities, which allows the plugin to bypass file read, write, and execute permission checks.
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`.
```bash ```bash
$ docker plugin ls $ docker plugin ls
ID NAME TAG DESCRIPTION ENABLED ID NAME DESCRIPTION ENABLED
69553ca1d789 vieux/sshfs latest the `sshfs` plugin true 7e08f3d484c9 cloudstor:azure cloud storage plugin for Docker true
``` ```
3. Create a volume using the plugin. 3. Create a volume using the plugin.
@ -84,35 +96,34 @@ enabled, and use it to create a volume.
```bash ```bash
$ docker volume create \ $ docker volume create \
-d vieux/sshfs \ -d cloudstor:azure \
--name sshvolume \ --name cloudstorvolume
-o sshcmd=user@1.2.3.4:/remote \
-o password=$(cat file_containing_password_for_remote_host)
sshvolume cloudstorvolume
``` ```
4. Verify that the volume was created successfully. 4. Verify that the volume was created successfully.
```bash ```bash
$ docker volume ls $ docker volume ls
DRIVER NAME DRIVER NAME
vieux/sshfs sshvolume cloudstor:azure cloudstorevolume
``` ```
5. Start a container that uses the volume `sshvolume`. 5. Start a container that uses the volume `cloudstorevolume`.
```bash ```bash
$ docker run --rm -v sshvolume:/data busybox ls /data $ docker run --rm -v cloudstorevolume:/data busybox sh -c 'echo test > /data/test'
$ docker run --rm -v cloudstorevolume:/data busybox cat /data/test
<content of /remote on machine 1.2.3.4> test
``` ```
6. Remove the volume `sshvolume` 6. Remove the volume `cloudstorevolume`
```bash ```bash
docker volume rm sshvolume docker volume rm cloudstorevolume
sshvolume cloudstorevolume
``` ```
To disable a plugin, use the `docker plugin disable` command. To completely To disable a plugin, use the `docker plugin disable` command. To completely
remove it, use the `docker plugin remove` command. For other available remove it, use the `docker plugin remove` command. For other available