SSH-Chat server in a Docker container. See shazow's ssh-chat repo to learn more about SSH-Chat.
Type this command into your terminal:
$ ssh casmacc.net -p 9000
$ docker build . -t casmacc/ssh-chat
$ docker run -p 2022:2022 casmacc/ssh-chat
Type this command into your terminal:
$ ssh localhost -p 2022
It is possible to start many ssh-chat
containers on a host, each listening on
a separate port.
version: '3'
services:
chat-project1:
image: casmacc/ssh-chat
volumes:
- ./volumes/ssh1:/root/.ssh
ports:
- "9000:2022"
restart: unless-stopped
chat-project2:
image: casmacc/ssh-chat
volumes:
- ./volumes/ssh2:/root/.ssh
ports:
- "9001:2022"
restart: unless-stopped
Then:
TERMINAL1> ssh <server> -p 9000
TERMINAL2> ssh <server> -p 9000
TERMINAL3> ssh <server> -p 9001
TERMINAL4> ssh <server> -p 9001
SSH Public Key for the container is in /root/.ssh/id_rsa
. SSH keys are
auto-generated by the startup script /root/ssh-chat.sh
.
Note that if you destroy and regenerate the container, new SSH keys will be created, and your SSH clients will complain. To avoid this annoyance, either:
- do not destroy the container - use
start/stop
instead. - OR - - save the .ssh directory in a volume, to make the keys persistent
For 2), here's the relevant snippet for your docker-compose file:
volumes:
- ./volumes/ssh:/root/.ssh