|
5 | 5 |
|
6 | 6 | TAG=test
|
7 | 7 |
|
8 |
| -# before_install |
9 |
| -#curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
10 |
| -#sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
11 |
| -#sudo apt-get update |
12 |
| -#sudo apt-get -y install docker-ce |
13 | 8 |
|
14 | 9 | # install
|
15 |
| -sudo docker pull rastasheep/ubuntu-sshd |
16 |
| -sudo docker pull busybox |
| 10 | +docker pull rastasheep/ubuntu-sshd |
| 11 | +docker pull busybox |
17 | 12 |
|
18 | 13 | docker build -t sshd tests/testdata
|
19 | 14 | #script
|
20 | 15 |
|
21 | 16 | # make the plugin
|
22 |
| -sudo PLUGIN_TAG=$TAG make |
| 17 | +PLUGIN_TAG=$TAG make |
23 | 18 | # enable the plugin
|
24 |
| -sudo docker plugin enable vieux/sshfs:$TAG |
| 19 | +docker plugin enable vieux/sshfs:$TAG |
25 | 20 | # list plugins
|
26 |
| -sudo docker plugin ls |
| 21 | +docker plugin ls |
27 | 22 | # start sshd
|
28 |
| -sudo docker run -d -p 2222:22 sshd |
| 23 | +docker run --name sshd -d -p 2222:22 sshd |
29 | 24 |
|
30 | 25 | # test1: simple
|
31 |
| -sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume |
32 |
| -sudo docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
33 |
| -sudo docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
34 |
| -#sudo cat /var/lib/docker/plugins/sshfs-state.json |
35 |
| -sudo docker volume rm sshvolume |
| 26 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume |
| 27 | +docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
| 28 | +docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
| 29 | +#cat /var/lib/docker/plugins/sshfs-state.json |
| 30 | +docker volume rm sshvolume |
36 | 31 |
|
37 | 32 | # test2: allow_other
|
38 |
| -sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o allow_other -o port=2222 -o password=root sshvolume |
39 |
| -sudo docker run --rm -v sshvolume:/write -u nobody busybox sh -c "echo hello > /write/world" |
| 33 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o allow_other -o port=2222 -o password=root sshvolume |
| 34 | +docker run --rm -v sshvolume:/write -u nobody busybox sh -c "echo hello > /write/world" |
40 | 35 | docker run --rm -v sshvolume:/read -u nobody busybox grep -Fxq hello /read/world
|
41 |
| -#sudo cat /var/lib/docker/plugins/sshfs-state.json |
42 |
| -sudo docker volume rm sshvolume |
| 36 | +#cat /var/lib/docker/plugins/sshfs-state.json |
| 37 | +docker volume rm sshvolume |
43 | 38 |
|
44 | 39 | # test3: compression
|
45 |
| -sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume |
46 |
| -sudo docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
47 |
| -sudo docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
48 |
| -#sudo cat /var/lib/docker/plugins/sshfs-state.json |
49 |
| -sudo docker volume rm sshvolume |
| 40 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume |
| 41 | +docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
| 42 | +docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
| 43 | +#cat /var/lib/docker/plugins/sshfs-state.json |
| 44 | +docker volume rm sshvolume |
| 45 | + |
| 46 | +# test4: restart |
| 47 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume |
| 48 | +docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
| 49 | +docker restart sshd |
| 50 | +docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
| 51 | +#cat /var/lib/docker/plugins/sshfs-state.json |
| 52 | +docker volume rm sshvolume |
50 | 53 |
|
51 | 54 | # test4: source
|
52 |
| -sudo docker plugin disable vieux/sshfs:$TAG |
53 |
| -sudo docker plugin set vieux/sshfs:$TAG state.source=/tmp |
54 |
| -sudo docker plugin enable vieux/sshfs:$TAG |
55 |
| -sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume |
56 |
| -sudo docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
57 |
| -sudo docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
58 |
| -#sudo cat /tmp/sshfs-state.json |
59 |
| -sudo docker volume rm sshvolume |
| 55 | +docker plugin disable vieux/sshfs:$TAG |
| 56 | +docker plugin set vieux/sshfs:$TAG state.source=/tmp |
| 57 | +docker plugin enable vieux/sshfs:$TAG |
| 58 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume |
| 59 | +docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
| 60 | +docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
| 61 | +#cat /tmp/sshfs-state.json |
| 62 | +docker volume rm sshvolume |
60 | 63 |
|
61 | 64 | # test5: ssh key
|
62 |
| -sudo docker plugin disable vieux/sshfs:$TAG |
63 |
| -sudo docker plugin set vieux/sshfs:$TAG sshkey.source=`pwd`/test/testdata/ |
64 |
| -sudo docker plugin enable vieux/sshfs:$TAG |
65 |
| -sudo docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 sshvolume |
66 |
| -sudo docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
67 |
| -sudo docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
68 |
| -#sudo cat /var/lib/docker/plugins/sshfs-state.json |
69 |
| -sudo docker volume rm sshvolume |
| 65 | +docker plugin disable vieux/sshfs:$TAG |
| 66 | +docker plugin set vieux/sshfs:$TAG sshkey.source=`pwd`/tests/testdata/ |
| 67 | +docker plugin enable vieux/sshfs:$TAG |
| 68 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 sshvolume |
| 69 | +docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
| 70 | +docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
| 71 | +#cat /var/lib/docker/plugins/sshfs-state.json |
| 72 | +docker volume rm sshvolume |
0 commit comments