garo/openssh-client

By garo

Updated almost 2 years ago

Base images from distro's with only OpenSSH *CLIENT* added, also one based on scratch

Image
Networking
Security
1

1.5K

garo/openssh-client repository overview

Docker Base Images with OpenSSH Client

These are base images from different distros with an OpenSSH CLIENT added
Also included is a empty image with only the ssh client.

Use Case

I created these images for one specific use case:
Accessing systems with SSH servers that frequently change their host keys (e.g. a system with a fixed IP that you often reinstall for testing).

Using the SSH client on my host system would require modifying my ~/.ssh/known_hosts, which I prefer to avoid.
Instead, these images create a temporary known_hosts file each time.

Usage

Some examples:

# A simple connection to "server" as "user":
docker run -it --rm garo/openssh-client ssh user@server

# But this time you want to be able to login with your keys instead of password:
docker run -it --rm -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro garo/openssh-client ssh user@server

# And now you also want some compression on the connection
docker run -it --rm -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro garo/openssh-client ssh -C user@server

# Using the Ubuntu based image
docker run -it --rm -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro garo/openssh-client:ubuntu ssh -C user@server

# Going lightweight and using a image only containing ssh. Note the slash in front of ssh here !
docker run -it --rm -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro garo/openssh-client:empty /ssh -C user@server

# Copying a `/home/user/somefile` to the server at `/some/location/`.
# Note that the file should be at a location that is also mounted in the container
docker run -it --rm -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro -v /home:/home:ro garo/openssh-client scp /home/user/somefile user@server:/some/location/

# Copying a file in the other direction. Note that this time read-only mounting is not enough
docker run -it --rm -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro -v /home:/home garo/openssh-client scp user@server:/some/location/somefile /home/user/

#For people that hate typing I strongly recommend this in your ~/.bashrc, ~/.zshrc, ...
alias sshdocker="docker run -it --rm -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro garo/openssh-client ssh"
alias scpdocker="docker run -it --rm -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro -v /home:/home garo/openssh-client scp"
#For the "scpdocker" you might want to add more "-v /some/path:/some/path:ro" options

Available Images

The images are named garo/openssh-client:tag-of-the-distro and are available for the amd64 and arm64 architectures.

DistroDistro VersionOpenSSH VersionClient programsTag(s)
None/9.8p1Only sshempty
Busybox1.36.19.8p1Only sshbusybox
Alpine3.20.29.7p1All but: ssh-argv0,sloginalpine, latest
Arch2024.08.049.8p1All but: ssh-argv0, sloginarch, arch-arm64
Debian129.2p1All but: ssh-pkcs11-helperdebian
Fedora409.6p1All but: ssh-argv0, slogin, ssh-pkcs11-helperfedora
Mageia99.3p1All but: ssh-argv0, slogin, ssh-pkcs11-helpermageia
Kali2024.29.7p1All but: ssh-pkcs11-helperkali
Ubuntu24.049.6p1All but: ssh-pkcs11-helperubuntu

Notes

  • "All clients programs" is scp, sftp, slogin, ssh, ssh-add, ssh-agent, ssh-argv0, ssh-copy-id, ssh-keygen, ssh-keyscan, ssh-pkcs11-helper
  • empty contains only 2 files:
    • /ssh (The self-compiled OpenSSH client)
    • /etc/passwd with only 1 line: root:x:0:0:root:/:/ssh (ssh needs to know it's user)
    • No other files or directories are present.
      This implies thay you will have to launch ssh as /ssh instead of ssh in empty
  • busybox contains the same self-compiled OpenSSH client.
  • Arch Linux has no official base image for arm64. arch-arm64 is based on an unofficial image and has a different tag to make it clear.
  • There is also a builder that was used to compile OpenSSH for empty and busybox. It cannot be used directly and should be ignored
  • For now consider all images (certainly empty and busybox) as experimental. Report all issues.

Contributing

  • Bugfixes and Dockerfile's for new distributions are always welcome. Submit all pull requests to the dev branch of the github repository at https://github.com/ngaro/dockerized-sshclient
  • If you create a Dockerfile ensure that the file name is Dockerfile.distroname and that they are the base images of that distro + the OpenSSH client. Try to avoid extra packages as much as you can.

Tag summary

Content type

Image

Digest

sha256:2f8703a56

Size

217.1 MB

Last updated

almost 2 years ago

docker pull garo/openssh-client:arch