https://github.com/dannyben/docker-sshd
Alpine SSH Client and Server
https://github.com/dannyben/docker-sshd
Last synced: 3 months ago
JSON representation
Alpine SSH Client and Server
- Host: GitHub
- URL: https://github.com/dannyben/docker-sshd
- Owner: DannyBen
- Created: 2019-05-03T12:01:18.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-01T07:57:37.000Z (almost 4 years ago)
- Last Synced: 2026-03-28T00:11:47.503Z (4 months ago)
- Language: Shell
- Size: 2.93 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Alpine SSH Client and Server
==================================================
Minimal Alpine ssh client and server.
Quick Start
--------------------------------------------------
You can use the [docker-compose](docker-compose.yml) file, to get up and
running quickly.
$ export AUTHORIZED_KEY="ssh-rsa ..."
$ docker compose up -d server
$ docker compose run --rm client
If you do not have an SSH key, you can generate a passphrase-less one with:
$ ssh-keygen -t rsa -C "you@email.com" -f id_rsa -N ''
Usage
--------------------------------------------------
This usage pattern shows how to have both a server and a client as docker
containers. If you need only one side of it, skip whatever is not relevant.
### Network
First, create a network for the two containers to share:
$ docker network create -d bridge dockernet
### Server
Create an environment variable with your public key, then start the server.
$ export AUTHORIZED_KEY="ssh-rsa ..."
$ docker run --rm -it -e AUTHORIZED_KEY \
--network dockernet \
--entrypoint /sshd-entrypoint \
--name server \
dannyben/sshd
### Client
In another terminal, mount your private key and connect to the server:
$ docker run --rm -it \
-v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro \
--network dockernet \
dannyben/sshd \
ssh server
Additional Information
--------------------------------------------------
- [dannyben/docker-sshd on GitHub][1]
- [dannyben/sshd on Docker Hub][2]
---
[1]: https://github.com/DannyBen/docker-sshd
[2]: https://hub.docker.com/r/dannyben/sshd/