The following command will mount root@10.0.0.10:/data to $PWD/mnt:
docker run -it --rm \
--cap-add SYS_ADMIN \
--device /dev/fuse \
--name sshfs \
-e UID=1000 \
-e GID=100 \
-v $PWD/mnt:/mount:shared \
-v ~/.ssh/id_ed25519:/config/id_ed25519:ro \
pschmitt/sshfs \
root@10.0.0.10:/dataCheck out the following docker-compose.yaml that mounts 10.127.0.11's /data to $PWD/mnt, via home.example.com.
version: '3'services:
jump-server:
image: pschmitt/sshcontainer_name: jump-server# restart: unless-stoppedvolumes:
- ./config:/config/.ssh:rocommand:
-o UserKnownHostsFile=/dev/null-o StrictHostKeyChecking=no-o ExitOnForwardFailure=yes-TN -L "*:22222:10.127.0.11:22"root@home.example.comsshfs:
image: pschmitt/sshfsdepends_on:
- jump-server# restart: unless-stoppedcap_add:
- SYS_ADMINdevices:
- /dev/fuse:/dev/fuseenvironment:
- PORT=22222
- UID=500
- GID=1000volumes:
- ./config/id_ed25519:/config/id_ed25519:ro
- ./mnt:/mount:sharedcommand: pschmitt@jump-server:/dataSet the remote's password via the SSHPASS env var.
Use the IDENTITY_FILE env variable to set the name of the key. It defaults to
/config/id_ed25519. For an RSA key it should be /config/id_rsa.
You can use a alternate port by setting the PORT env var.
TODO: Not implemented yet.