Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit d7c3e8e

Browse files
authored
Merge pull request #33 from vieux/private_key
ssh config files and/or private keys
2 parents 653cb68 + 69972ed commit d7c3e8e

File tree

7 files changed

+126
-32
lines changed

7 files changed

+126
-32
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
sudo: required
1818
services:
1919
- docker
20+
before_install:
21+
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
22+
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
23+
- sudo apt-get update
24+
- sudo apt-get -y install docker-ce
2025
env: TESTFILE=integration.sh
2126

2227
script:

.travis/integration.sh

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,64 @@ set -x
66
TAG=test
77

88
# 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
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
1313

1414
# install
15-
docker pull rastasheep/ubuntu-sshd:14.04
16-
docker pull busybox
15+
sudo docker pull rastasheep/ubuntu-sshd
16+
sudo docker pull busybox
1717

18+
docker build -t sshd .travis/ssh
1819
#script
1920

2021
# make the plugin
21-
PLUGIN_TAG=$TAG make
22+
sudo PLUGIN_TAG=$TAG make
2223
# enable the plugin
23-
docker plugin enable vieux/sshfs:$TAG
24+
sudo docker plugin enable vieux/sshfs:$TAG
2425
# list plugins
25-
docker plugin ls
26+
sudo docker plugin ls
2627
# start sshd
27-
docker run -d -p 2222:22 rastasheep/ubuntu-sshd:14.04
28+
sudo docker run -d -p 2222:22 sshd
2829

2930
# test1: simple
30-
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume
31-
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
32-
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
33-
sudo cat /var/lib/docker/plugins/sshfs-state.json
34-
docker volume rm sshvolume
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
3536

3637
# test2: allow_other
37-
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o allow_other -o port=2222 -o password=root sshvolume
38-
docker run --rm -v sshvolume:/write -u nobody busybox sh -c "echo hello > /write/world"
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"
3940
docker run --rm -v sshvolume:/read -u nobody busybox grep -Fxq hello /read/world
40-
sudo cat /var/lib/docker/plugins/sshfs-state.json
41-
docker volume rm sshvolume
41+
#sudo cat /var/lib/docker/plugins/sshfs-state.json
42+
sudo docker volume rm sshvolume
4243

4344
# test3: compression
44-
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume
45-
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
46-
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
47-
sudo cat /var/lib/docker/plugins/sshfs-state.json
48-
docker volume rm sshvolume
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
4950

5051
# test4: source
51-
docker plugin disable vieux/sshfs:$TAG
52-
docker plugin set vieux/sshfs:$TAG state.source=/tmp
53-
docker plugin enable vieux/sshfs:$TAG
54-
docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume
55-
docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world"
56-
docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world
57-
sudo cat /tmp/sshfs-state.json
58-
docker volume rm sshvolume
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
5960

61+
# test5: ssh key
62+
sudo docker plugin disable vieux/sshfs:$TAG
63+
sudo docker plugin set vieux/sshfs:$TAG sshkey.source=`pwd`/.travis/ssh/
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

.travis/ssh/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM rastasheep/ubuntu-sshd
2+
COPY id_rsa.pub /root/.ssh/authorized_keys

.travis/ssh/id_rsa

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-----BEGIN RSA PRIVATE KEY-----
2+
MIIEowIBAAKCAQEAuwYzjYtn18PcI8GGNUweOZNxj62GhNana2H5ytd4zW8Sr9p+
3+
YfbW5KC3I3HEvz1ELf8FtD1upJZ/YKNH7qloS5BV02G6k9SDqJuC/MMcKuHfVEjx
4+
avvTDB2iCigui1Cf3r6XxQJ3T4ViH8IrYdMpU+fuVpOlvunBADBW+ze00eIOpI5g
5+
46Mo2qBdxygQfOlp2T9DxqlDkr3SK6GbcLMhUvnqtc/m3xxGvbdWGl4IjNl5UdS7
6+
1REmnpNyAkozfimR+1XK5yRd/jU/5VXjXXxtxBHW3zGqiHmaIskRhGcMEh732ij3
7+
JOjjpPHsrfWRaU02VuX3dE4AJNifcafeirDMfwIDAQABAoIBAFiBWMg1HpFHCNiK
8+
7p4uRWdt1SHvNmeKxXPVy8YoLezaEXfS6Fgn3g4X2FMXtcnijm9N7j8bi06sQd9T
9+
pejVlpub1GHSL99hhGS4I0bGdn/8oBlc45KDVZ64L0SrO0uGfgGFJIGA50Fkl8j7
10+
tFf4++fPLEUgXiF4sXMLbT45YIKpriE9HZf641YpR2tUGHwTnosAQdyYgiS2/pYB
11+
GhmQsKYxnSxS4yWfVrKYW4Y28YvxmTArZ7Xy2j+AtfYSK4CwVREEeEEq4nACdscL
12+
joFO2a+pth2ceuOS5al/z0OYR6zMKPLAZOJJWpaXeHn50/pHJ+09hiOOU8m1iAL+
13+
ZRFWhKECgYEA6+RPoyWQ33J1Ms19W21YJ8oScr2VnwDxAGcdat2MLTMvkpGl/rhf
14+
OeeNcx+Cp8uwDEzdyH01X0YW/YKNKEf0uH72FWJ59Uaw2akLFQNueHYlYt3xjcdz
15+
sobAbUbncqLB8Pw664/QxQ9lehPQ5sgLKkoAFR4yPLuMHU8gDZ6nWukCgYEAyvd9
16+
ROgMjCBVlQWfhBQB5EB62I5uRPUsQwaBDV9wwxpGOwl3+xDo9egVVRVIkXsW7UK8
17+
NrQ0EMG8z3BVs/kLDTZ/GRn+ZFWt6YQ79+4TnMwSRr5iqS0j39BrjiPZBDAN0f+l
18+
YIfJSIh9YggwAiQ6fAJJlcsRjMRurwBJxqfkeycCgYBy/h2EXq+8/cL8PQg7JZav
19+
7uYHYTwrAv55P8sraU0IS8eJH89X2PEy/RoLYPUEb1sm4+HJ9p+qDjTu6FF/rXQy
20+
7FFyI0tosklMEggA+mdD+fRHugIjJ3PTN7VekA4L6CO7Inpmkvkm11aUqExR9Hrc
21+
5q4bnVjIGnU3ZHcvrIPQ4QKBgQDExqDql1bi285dRjBa6tLSqjjvj1cU/+XDraCc
22+
iHVYkjaYshtijAhvsGxOKu5KLV4S9Opo1tjLjikxrCVK8R5n1vfuLCdYu0B67zr8
23+
qhLVp3vonlgk0KDBMt2z1sllp/keKY36QmtBKSL2Uh3JVbpl1AnnchM3uJHelJby
24+
RH/dbQKBgCWDV7E2Lo5QDLeuWnfzIcb5bdQRhwLI/9ff59W8msGxxd3ARIt64j3W
25+
FY1/j5hP/K/4ZVjkWebQ7scBdRfxIBj+2/AwTrRSXFAD5qrm8I/1pzyFJ8SJ/cJD
26+
SKCR8dkyJZnqp5XX9RbP/AiY1VN9VHY1RCyV+FKXQD9jpZ0IgxCZ
27+
-----END RSA PRIVATE KEY-----

.travis/ssh/id_rsa.pub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7BjONi2fXw9wjwYY1TB45k3GPrYaE1qdrYfnK13jNbxKv2n5h9tbkoLcjccS/PUQt/wW0PW6kln9go0fuqWhLkFXTYbqT1IOom4L8wxwq4d9USPFq+9MMHaIKKC6LUJ/evpfFAndPhWIfwith0ylT5+5Wk6W+6cEAMFb7N7TR4g6kjmDjoyjaoF3HKBB86WnZP0PGqUOSvdIroZtwsyFS+eq1z+bfHEa9t1YaXgiM2XlR1LvVESaek3ICSjN+KZH7VcrnJF3+NT/lVeNdfG3EEdbfMaqIeZoiyRGEZwwSHvfaKPck6OOk8eyt9ZFpTTZW5fd0TgAk2J9xp96KsMx/ [email protected]

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ This plugin allows you to mount remote folder using sshfs in your container easi
77

88
## Usage
99

10+
### Using a password
11+
1012
1 - Install the plugin
1113

1214
```
@@ -40,6 +42,41 @@ vieux/sshfs sshvolume
4042
$ docker run -it -v sshvolume:<path> busybox ls <path>
4143
```
4244

45+
### Using an ssh key
46+
47+
1 - Install the plugin
48+
49+
```
50+
$ docker plugin install vieux/sshfs sshkey.source=/home/<user>/.ssh/
51+
52+
# or to enable debug
53+
docker plugin install vieux/sshfs DEBUG=1 sshkey.source=/home/<user>/.ssh/
54+
55+
# or to change where plugin state is stored
56+
docker plugin install vieux/sshfs state.source=<any_folder> sshkey.source=/home/<user>/.ssh/
57+
```
58+
59+
2 - Create a volume
60+
61+
```
62+
$ docker volume create -d vieux/sshfs -o sshcmd=<user@host:path> [-o IdentityFile=/root/.ssh/<key>] [-o port=<port>] [-o <any_sshfs_-o_option> ] sshvolume
63+
sshvolume
64+
$ docker volume ls
65+
DRIVER VOLUME NAME
66+
local 2d75de358a70ba469ac968ee852efd4234b9118b7722ee26a1c5a90dcaea6751
67+
local 842a765a9bb11e234642c933b3dfc702dee32b73e0cf7305239436a145b89017
68+
local 9d72c664cbd20512d4e3d5bb9b39ed11e4a632c386447461d48ed84731e44034
69+
local be9632386a2d396d438c9707e261f86fd9f5e72a7319417901d84041c8f14a4d
70+
local e1496dfe4fa27b39121e4383d1b16a0a7510f0de89f05b336aab3c0deb4dda0e
71+
vieux/sshfs sshvolume
72+
```
73+
74+
3 - Use the volume
75+
76+
```
77+
$ docker run -it -v sshvolume:<path> busybox ls <path>
78+
```
79+
4380
## LICENSE
4481

4582
MIT

config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@
4141
"source"
4242
],
4343
"type": "bind"
44+
},
45+
{
46+
"destination": "/root/.ssh",
47+
"options": [
48+
"rbind"
49+
],
50+
"name": "sshkey",
51+
"source": "",
52+
"settable": [
53+
"source"
54+
],
55+
"type": "bind"
4456
}
4557
],
4658
"network": {

0 commit comments

Comments
 (0)