Giter Site home page Giter Site logo

pschmitt / docker-sshfs Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 12.0 42 KB

Docker container to mount directories via SSH. For CoreOS Container Linux.

License: GNU General Public License v3.0

Shell 70.16% Dockerfile 29.84%
sshfs docker ssh coreos coreos-container-linux

docker-sshfs's Introduction

sshfs for CoreOS Container Linux

Usage

The following command will mount [email protected]:/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 \
    [email protected]:/data

Using a jump server

Check 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/ssh
    container_name: jump-server
    # restart: unless-stopped
    volumes:
      - ./config:/config/.ssh:ro
    command:
      -o UserKnownHostsFile=/dev/null
      -o StrictHostKeyChecking=no
      -o ExitOnForwardFailure=yes
      -TN -L "*:22222:10.127.0.11:22"
      [email protected]

  sshfs:
    image: pschmitt/sshfs
    depends_on:
      - jump-server
    # restart: unless-stopped
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse:/dev/fuse
    environment:
      - PORT=22222
      - UID=500
      - GID=1000
    volumes:
      - ./config/id_ed25519:/config/id_ed25519:ro
      - ./mnt:/mount:shared
    command: pschmitt@jump-server:/data

Authentification

Password auth (discouraged)

Set the remote's password via the SSHPASS env var.

RSA keys

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.

Options

Different port

You can use a alternate port by setting the PORT env var.

Compression

TODO: Not implemented yet.

docker-sshfs's People

Contributors

archef2000 avatar dependabot[bot] avatar pschmitt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-sshfs's Issues

/mnt is mounted on /host_mnt/e but it is not a shared mount

PS E:\WorkDev\docker-sshfs> docker run -it --rm --cap-add SYS_ADMIN --device /dev/fuse --name sshfs -e UID=1000 -e GID=100 -v $PWD/mnt:/mount:shared sshfs_alpine [email protected]:/home/www
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: path /host_mnt/e/WorkDev/docker-sshfs/mnt is mounted on /host_mnt/e but it is not a shared mount.

Running on Windows 10

Traps not working

I noticed that after the container is stopped/killed/removed the mount point is made unusable and the next time you start the container it will fail. I have to sudo umount the mount from my host in order to have things work again.

As far as I can tell this is because the traps are not working in the entrypoint script. I've been playing around but unable to get the trap function to ever become executed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.