- Run
ssh-keygen
- Enter your key name.
- Run
cp .env.example .env
- Populate
PUBLIC_KEY
value with the content ofid_rsa.pub
that generated from above step.
pnlinh@Linhs-MacBook-Pro:~# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/pnlinh/.ssh/id_rsa): id_rsa
This repository already has a docker-compose.yml
so you just need to run docker-compose up -d --build
version: "3.8"
services:
open-ssh-server:
image: ghcr.io/pnlinh-it/ssh-tunnel-server:latest
container_name: ssh-tunnel-server
restart: unless-stopped
environment:
PUBLIC_KEY: "${PUBLIC_KEY}"
ports:
- "2223:22"
If you use nginx-proxy and acme-companion, you can consider below compose file:
version: "3.8"
services:
open-ssh-server:
image: ghcr.io/pnlinh-it/ssh-tunnel-server:latest
container_name: open-ssh-server
restart: unless-stopped
environment:
PUBLIC_KEY: "${PUBLIC_KEY}"
VIRTUAL_HOST: <your_domain>
LETSENCRYPT_HOST: <your_domain>
networks:
- tunnel
- nginx-proxy
ports:
- "2223:22"
expose:
- "80"
networks:
tunnel:
driver: bridge
name: tunnel
nginx-proxy:
external: true
name: nginx-proxy