A minimal docker image for running SSH commands
474
A minimal docker image for running SSH commands based on alpine distribution. Perfect for integrating in a CI pipeline.
The image is available in docker hub
A private key needs to be provided to the container in the SSH_PRIVATE_KEY environment variable.
For example, to laod the private key from a file:
docker run --rm -ti -e SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" papaux/ssh-slim ssh <user>@<host> ls
Example of a deploy stage in .gitlab-ci.yml using this image.
The SSH private key is stored in the Gitlab project configuration
as a secret with the name ${YOUR_GITLAB_SECRET_PRIVATE_KEY}
deploy to staging:
stage: staging
image: papaux/ssh-slim
environment:
name: staging
url: https://staging.your-service.com
only:
- master
variables:
SSH_PRIVATE_KEY: ${YOUR_GITLAB_SECRET_PRIVATE_KEY}
GIT_STRATEGY: none
script:
- ssh [email protected] git:from-image <your-app> <your-docker-image>
docker build -t ssh-slim --build-arg ALPINE_VERSION=3.13 .
Currently the image only supports ssh keys without passphrase.
Instead of providing one Dockerfile per version, this image relies on the configured docker tag to fetch the corresponding alpine image version.
It will basically pick whatever "Docker Tag" is configured from the Build Rules. For instance:

Documentation about build hooks is really hard to find, especially what is the default build command in the hook.
These links can be useful to understand:
Content type
Image
Digest
sha256:9c1368f34…
Size
11.5 MB
Last updated
over 2 years ago
docker pull papaux/ssh-slim