Coder Social home page Coder Social logo

docker-rsyncssh's Introduction

ssh+rsync Docker image

Once configured to accept one or more ssh keys, it will permit one to use rsync+ssh to store data or to read data to/from the docker container.

The container is exporting:

  • port 22 (for ssh connections)
  • /data volume

Build image

docker build --rm -t ssh-rsync-image .

Run the container

  • First you need to create at least one ssh key (without passphrase)
ssh-keygen -t rsa -f ~/.ssh/id_rsa_rsync -N ''
  • Run the container:
docker run -itdP -p 22222:22 -v ~/data:/data -e AUTHORIZED_KEYS="rw:`cat ~/.ssh/id_rsa_rsync.pub`" --name ssh-rsync-server ssh-rsync-image
  • Check logs:
docker logs ssh-rsync-server 

Use

  • Rsync local /etc to remote /data/etc (note: all paths are always relative to /data)
rsync -av -e "ssh -i $HOME/.ssh/id_rsa_rsync -p 22222" /etc [email protected]:/

About authorized keys:

  • each key has to be prefixed by rw: or ro:, repectively for read+write access or read-only access
  • multiple keys can be specified, separated by "," (commas)

Exemple: AUTHORIZED_KEYS="rw:myfirstkey, ro:mysecondkey"

Inspired by:

docker-rsyncssh's People

Contributors

zas avatar

Watchers

 avatar  avatar

Forkers

ripperdoc

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.