A minimal Alpine-based Docker image for autossh.
The image runs autossh as non-root via reusable scripts from coolcow/entrypoints and supports injecting SSH material through /install.
docker run --rm ghcr.io/coolcow/autossh --helpMount a directory with SSH files (for example config, id_rsa, known_hosts) to /install.
Files are copied to ${AUTOSSH_HOME}/.ssh before autossh starts.
docker run --rm \
-e AUTOSSH_UID=$(id -u) \
-e AUTOSSH_GID=$(id -g) \
-v /path/to/autossh-home:/home/autossh \
-v /path/to/ssh-files:/install:ro \
ghcr.io/coolcow/autossh \
-M 0 -N user@example.org| Variable | Default | Target | Description |
|---|---|---|---|
AUTOSSH_UID |
1000 |
TARGET_UID |
User ID to run the process as. |
AUTOSSH_GID |
1000 |
TARGET_GID |
Group ID to run the process as. |
AUTOSSH_REMAP_IDS |
1 |
TARGET_REMAP_IDS |
Set to 0 to disable remapping conflicting UID/GID entries. |
AUTOSSH_USER |
autossh |
TARGET_USER |
Runtime user name inside the container. |
AUTOSSH_GROUP |
autossh |
TARGET_GROUP |
Runtime group name inside the container. |
AUTOSSH_HOME |
/home/autossh |
TARGET_HOME |
Home directory used by autossh and as default workdir. |
AUTOSSH_SHELL |
/bin/sh |
TARGET_SHELL |
Login shell for the runtime user. |
Target shows the corresponding variable used by coolcow/entrypoints.
Customize the image at build time with docker build --build-arg <KEY>=<VALUE>.
| Argument | Default | Description |
|---|---|---|
ALPINE_VERSION |
3.23.3 |
Version of the Alpine base image. |
ENTRYPOINTS_VERSION |
2.2.0 |
Version of the coolcow/entrypoints image used for scripts. |
Runtime user/group environment variables were renamed to image-specific AUTOSSH_* names.
PUID→AUTOSSH_UIDPGID→AUTOSSH_GIDENTRYPOINT_USER→AUTOSSH_USERENTRYPOINT_GROUP→AUTOSSH_GROUPENTRYPOINT_HOME→AUTOSSH_HOME
Update your docker run / docker-compose environment configuration accordingly when upgrading from older tags.
Run the built-in smoke tests locally.
docker build -t ghcr.io/coolcow/autossh:local-test-build -f build/Dockerfile builddocker build --build-arg APP_IMAGE=ghcr.io/coolcow/autossh:local-test-build -f build/Dockerfile.test build
MIT. See LICENSE.txt for details.