一個簡單的openssh server image,約有30MB。
我們可以透過他及docker volume分享的方式串接不同服務。
例如: gogs + ossh + D-Laravel
Build OpenSSH image to only with a public key authentication.
You can setup authorized_keys before build an image.
docker build -t ossh .
docker run --rm --name ossh -dp 2222:22 ossh
docker exec -ugit -ti ossh sh cd ~/.ssh echo "your_open_ssh_public_key" > authorized_keys
docker build \ --build-arg uid=48 \ --build-arg gid=48 \ --build-arg user=apach \ -t ossh48 \ .
cat ~/.ssh/id_ed25519.pub > authorized_keys
docker build \ --build-arg uid=$(id -u) \ --build-arg gid=$(id -g) \ --build-arg user=$USER \ -t ossh \ .
Or, You can build specified docker file as below command. (this one can run VS Code with Remote - SSH)
docker build \ --build-arg uid=1000 \ --build-arg gid=1000 \ --build-arg user=dlaravel \ -t ossh \ -f Dockerfile-ubuntu \ .
docker run --name ossh -v $(pwd):/var/www/html -dp 2222:22 ossh