- Shell 52.5%
- Makefile 25.2%
- Dockerfile 22.3%
|
All checks were successful
Standard Build / build (push) Successful in 3m29s
|
||
|---|---|---|
| .forgejo/workflows | ||
| .dockerignore | ||
| .gitignore | ||
| 10-ssh-container.conf | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| setup-root-ssh | ||
| ssh-entrypoint | ||
| ssh-healthcheck | ||
| ssh-setup | ||
| update-ssh-keys | ||
SSH Container
A simple container which runs SSH upon startup.
It will persist SSH host keys in /srv/ssh/ - thus allowing the
container to have a persistent SSH "identity" across startups.
Note that this container does not set up any users.
If the environment variable ROOT_AUTHORIZED_KEY is set, this will be
added to /root/.ssh/authorized_keys.
It does make some minor tweaks to the Debian default SSH
configuration to enforce that root can only login using a key
(password authentication is not allowed) - see
10-ssh-container.conf for details.
The container's ENTRYPOINT (technically /ssh-setup) will generate
keys as needed (and persist them to /srv/ssh/) and start a SSH
daemon before launching the given command. If no command is given, it
will default to /bin/bash.
Ports
The container will expose an SSH server on port 22.
Volumes
To persist across container restarts: mount a persistent volume on
/srv/ssh.
Health Check
The container provides a simple health check with the command /ssh-healthcheck.
Building on This
If you build a container based on this image, be sure to do exactly one of:
-
Do not override the Dockerfile
ENTRYPOINT, thus leaving theENTRYPOINTfrom this container in effect. -
Early in your entrypoint script: make a call to
/ssh-setup. Be sure to to handle a non-zero exit code fromssh-setupcorrectly - e.g.:#!/bin/sh set -e /ssh-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/ssh-entrypointgiving the path to your own entrypoint (and any parameters it needs) as parameters - e.g.:# Dockerfile ... COPY mycontainer-entrypoint /mycontainer-entrypoint ENTRYPOINT ["/ssh-entrypoint", "/mycontainer-entrypoint", "foo", "bar"] ...
Also: be sure to invoke /ssh-healthcheck as part of your own
healthcheck.