- Shell 68.8%
- Makefile 20.3%
- Dockerfile 10.9%
|
All checks were successful
Docker Build / build (push) Successful in 2m59s
|
||
|---|---|---|
| .forgejo/workflows | ||
| .dockerignore | ||
| Dockerfile | ||
| Makefile | ||
| README.md | ||
| rsync-entrypoint | ||
| rsync-healthcheck | ||
| rsync-setup | ||
rsync
A simple container which provides an SSH server and has rsync &
unison installed.
This is based on https://code.jorgensen.org.uk/karl/ssh-container -
see the
README.md
there for details about how to configure SSH keys for the root user.
This is intended as a simple utility to allow users to update files in e.g. a volume.
For most use cases we want a use a non-root user for access. This is controlled through environment variables:
-
USER_NAMEspecifies the username to be created. If this is not set, no user will be created. -
USER_ID(optional) the numeric ID of the user. If not set, the container will choose a UID. Note that a container-chosen UID is not guaranteed to be consistent across invocations or container versions. -
HOMEDIR(optional) The$HOMEdirectory of the user. If not set, a suitable default will be used. -
USER_SHELL(optional) - the user's shell. -
GROUP_NAME(optional) name of the user's primary group -
GROUP_ID(optional) numeric ID ofGROUP_NAME -
USER_COMMENT(optional) the comment (a.k.a. GECOS) information for the user. -
USER_PUBKEY: The user's public key. This will be what ends up in the user's.ssh/authorized_keysfile. This may contain newlines, which will allow for multiple keys.To limit the user to running
rsync(or some other command), this can be done using the usual SSH facilities - see the man page for SSHD(8) - the AUTHORIZED_KEYS FILE FORMAT section.
NOTE: The user will be configured to not allow password-based
logins. So setting USER_PUBKEY is quite essential.
Ports
The container will expose an SSH server on port 22.
Volumes
To persist SSH keys across container restarts: mount a persistent
volume on /srv/ssh.
Health Check
The container provides a simple health check with the command
/rsync-healthcheck.
Building on This
If you build a container based on this image, be sure to do one of:
-
Do not override the Dockerfile
ENTRYPOINT, thus leaving theENTRYPOINTfrom this container in effect. -
Early in your entrypoint script: make a call to
/rsync-setup. Be sure to to handle a non-zero exit code fromrsync-setupcorrectly - e.g.:#!/bin/sh set -e /rsync-setup # Do your own stuff hereIt is also recommended that you provide your setup script (e.g. named
/mycontainer-setup) and make it available for users who want to build on top of your container - probably with instructions similar to this in your ownREADME.mdfile. -
Make your Dockerfile
ENTRYPOINTa call to/rsync-entrypointgiving the path to your own entrypoint (and any parameters it needs) as parameters - e.g.:# Dockerfile ... COPY mycontainer-entrypoint /mycontainer-entrypoint ENTRYPOINT ["/rsync-entrypoint", "/mycontainer-entrypoint", "foo", "bar"] ...
Also: be sure to invoke /rsync-healthcheck as part of your own
healthcheck.