Code Monkey home page Code Monkey logo

rsync-ssh-docker-image's Introduction

Rsync + SSH Docker image

Release CI Docker Hub

Docker Hub | GitHub Container Registry | Quay.io

Changelog

Supported tags and respective Dockerfile links

Supported platforms

  • linux: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x

What is Rsync and SSH?

SSH (Secure Shell) is a cryptographic network protocol for operating network services securely over an unsecured network. The best known example application is for remote login to computer systems by users.

Rsync is a utility for efficiently transferring and synchronizing files across computer systems, by checking the timestamp and size of files. It is commonly found on Unix-like systems and functions as both a file synchronization and file transfer program. The rsync algorithm is a type of delta encoding, and is used for minimizing network usage. Zlib may be used for additional compression, and SSH or stunnel can be used for data security.

How to use this image

Just prepend rsync/ssh command with docker run instrumentisto/rsync-ssh:

docker run --rm -i instrumentisto/rsync-ssh rsync --help

Transferring data from volume to local folder:

docker run --rm -i -v <volume-name>:/volume -v $(pwd):/mnt instrumentisto/rsync-ssh \
    rsync -avz /volume/ /mnt/

Transferring file from remote host with rsync to local host without rsync:

docker run --rm -i -v <local-dest-path>:/mnt instrumentisto/rsync-ssh \
    rsync -avz <remote-host>:<remote-src-path> /mnt/

Transferring file from remote host without rsync to local host with rsync:

rsync -avz --rsync-path="docker run --rm -i -v <remote-src-path>:/mnt instrumentisto/rsync-ssh rsync" \
    <remote-host>:/mnt/ <local-dest-path>

Transfer file from remote host without rsync to local host without rsync:

docker run --rm -i -v <local-dest-path>:/mnt instrumentisto/rsync-ssh \
    rsync -avz --rsync-path="docker run --rm -i -v <remote-src-path>:/mnt instrumentisto/rsync-ssh rsync" \
        <remote-host>:/mnt/ /mnt/

Image tags

alpine

Latest tag of the latest Alpine version.

This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

This is a multi-platform image.

alpine<X.Y>

Latest tag of the latest minor X.Y Alpine version.

This is a multi-platform image.

alpine<X.Y>-r<N>

Concrete N image revision tag of the concrete minor X.Y Alpine version.

Once built, it's never updated.

This is a multi-platform image.

alpine<X.Y>-r<N>-<os>-<arch>

Concrete N image revision tag of the concrete minor X.Y Alpine version on the concrete os and arch.

Once built, it's never updated.

This is a single-platform image.

License

Rsync is licensed under GNU GPL version 3 license.
OpenSSH Portable is licensed under BSD licence.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

The sources for producing instrumentisto/rsync-ssh Docker images are licensed under Blue Oak Model License 1.0.0.

Issues

We can't notice comments in the DockerHub (or other container registries) so don't use them for reporting issue or asking question.

If you have any problems with or questions about this image, please contact us through a GitHub issue.

rsync-ssh-docker-image's People

Contributors

afonsoc12 avatar chkg2a avatar dependabot[bot] avatar inceabdullah avatar rvanlaak avatar targs08 avatar tyranron avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rsync-ssh-docker-image's Issues

Container is exiting without log

I am trying to use this image to rsync a backups volume every day automatically.
I tried to manually run my rsync command using this image and it works fine. But the problem is that when the command is done the container is exiting. Perhaps this is the intended behavior, but this is quite problematic for my use case: the rsync should be run automatically.
The fact that the /etc/periodic folders exist makes me think that this image can run in the background.
Here's an excerpt from my compose file :

  backupRsync:
    container_name: backupRsync
    image: instrumentisto/rsync-ssh
    volumes:
      - backups:/backups
      - ./backup/backup-rsync.sh:/etc/periodic/daily/backup-rsync.sh # every day at 02:00
    depends_on:
      - backuper
    logging:
      driver: "json-file"
      options:
        max-size: "512m"
    restart: unless-stopped

If I add a "while true; do sleep 10; done" command section, the container does not stop. But it feels like a dirty workaround. Is there a way to keep this image running? Thanks.

Certificates unknown / can not get resolved

It seems the image can not resolve certificates in many cases. In our case; letting CircleCI attach a workspace (which downloads an artifact from aws).

Error message:

RequestError: send request failed x509: certificate signed by unknown authority

Adding ca-certificates in Alpine solves the problem, as described in aws/aws-sdk-go#2322 (comment)

Add RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* to dockerfile

Resources

https://discuss.circleci.com/t/requesterror-x509-certificate-signed-by-unknown-authority-while-uploading-workspace/27908

permission denied while trying to connect to the Docker daemon socket

I am using this command:

root@NAS:/# docker run --rm --name=rsync_sg2nas -i -v /root/.ssh:/root/.ssh -v /volume2/docker/@OCI-SG:/mnt instrumentisto/rsync-ssh \
    rsync -avzut --exclude 'ollama' --exclude 'pgsql' --exclude 'ubuntu' --delete --rsync-path="docker run --rm -i -v /docker:/mnt instrumentisto/rsync-ssh rsync" \
        SG:/mnt/ /mnt/

My goal is to synchronize the data in the /Docker directory from the remote server SG to the local server /volume2/Docker/@OCI-SG

The error I encountered is:

docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Head "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [Receiver=3.2.7]

I tried to add the following parameters but did not solve the problem:

--user root
--privileged
-v /var/run/docker.sock:/var/run/docker.sock

I am not sure if a root account is required in the remote server, as my root account cannot be directly used for login, so I don't know how to solve this problem

Additional information

In the local server, I use the root account and can use containers such as Watchtower and Portainer that require Docker Daemon permissions

Remote server: Ubuntu (Linux 6.5.0-1018 Oracle # 18~22.04.1 Ubuntu SMP Sat Feb 17 22:00:50 UTC 2024 aarch64 aarch64 GNU/Linux)

Local server: Synology NAS (Linux 3.10.108 # 69057 SMP Fri Jan 12 16:59:54 CST 2024 x86_64 GNU/Linux Synology Braswell 716+)

Put some example usage into docs

For example:
rsync -avz --rsync-path="docker run -i --rm -v SOMEVOLUME:/mnt instrumentisto/rsync-ssh rsync" SOMEHOST:/mnt/ SOMELOCALPATH/

;-)

arm version

Would it be possible for you to provide an arm version of this so that it can be used on a raspberry pi? Many thanks

docker rsync run doesn't exit

Hi,
i was testing with following command
docker run -rm -i --net=host -v ~/.ssh:/root/.ssh -v /mnt:/mnt instrumentisto/rsync-ssh rsync -az --progress --zc=zstd --rsync-path="sudo docker run --rm -i --net=host -v ~/.ssh:/root/.ssh -v /mnt:/mnt instrumentisto/rsync-ssh rsync" user@ip:/mnt/...pathtofile /mnt/localfolder

The file is copied succesfully to localfolder but the docker command doesn't exit.
Any help?

While this command docker run -rm -i --net=host -v ~/.ssh:/root/.ssh -v /mnt:/mnt instrumentisto/rsync-ssh rsync --version sucesfully exit after run.

Host key verification failed for 'Transferring file from remote host with rsync to local host without rsync:'

We have two ubuntu host systems[ssh client and ssh server] with docker container running on the client. our aim is to transfer the file from server host to client host using the docker container[instrumentisto /rsync-ssh ]running on the client.
We have generated the public and private key on the client[id_rsa,id_rsa.pub] and added the public key in the authorized_keys file on the server. we have tried the following command and we're getting the "Host key verification failed" error.

sudo docker run --rm -i -v /home/testuser1/.ssh/:/ssh-key/ -v /home/testuser1/client_rsync/:/mnt/ instrumentisto/rsync-ssh rsync -auvz -e "ssh -i /ssh-key/id_rsa" testuser1@[ip address of server]:/home/testuser1/server_rsync/ /mnt/

Note: we have verified the keys by ssh login from the client to server and it logs in without password

Best practices for handling ssh keys or credentials?

If when needing to provide an ssh key or basic credentials for the rsync over ssh remote endpoint, do you have best practices or documented strategies?

I intend to have a container from the image in a docker-compose stack as a service rsync over ssh so it can be used by other services in the stack. So it is not going to be a manually typed line, and want to have the ssh key or credentials available but securely accessible to the container from the environment.

I've considered volume bind mounting to the host and have the host have a user's ssh id_rsa be the ssh identity, etc. but curious what other ways might be possible and/or recommended so that security measures can be upheld as best as possible.

Maybe the documentation can be updated to include some various examples of how this might be handled?

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.