Sign inSign up

iatebes/docker-ssh-server

By iatebes

Updated about 10 years ago

SSH Server for Docker containers - clone from jeroenpeeters/docker-ssh

Image
1

1.1K

iatebes/docker-ssh-server repository overview

ISSUE

If you want to SSH into Docker Container through Docker's Host IP, just use this image to make all running docker container accessible. Reference Source : https://github.com/jeroenpeeters/docker-ssh

RUN

First, pull docker ssh server image

$ docker pull iatebes/docker-ssh-server

Conssider that you have running container like this :

CONTAINER ID   IMAGE    COMMAND   CREATED          STATUS           PORTS                  NAMES
d147ceba4cbd   centos   "bash"    30 minutes ago   Up 30 minutes    0.0.0.0:2222->22/tcp   desperate_murdock

So, run SSH Server by this command

$ docker run -e CONTAINER=d1 -e AUTH_MECHANISM=noAuth --name sshd-web-server1 -p 8022:8022 -p 2223:22 --rm -v /var/run/docker.sock:/var/run/docker.sock iatebes/docker-ssh-server
CONNECT

SSH using Docker's Host IP

$ ssh -p 2223 <docker_host_ip>
PARAMETERS
  • -e CONTAINER=d1 : set environment parameter inside ssh server container CONTAINER = d1, d1 is the short id of above container that you want to SSH to
  • -e AUTH_MECHANISM=noAuth : set environment parameter AUTH_MECHANISM = noAuth, that mean you can login with any user
  • --name sshd-web-server1 : name this ssh-server container
  • -p 8022:8022 : expose port 8022 to host, from now on you can access http://<docker_host>:8022 with internet browser like chrome/firefox as SSH Client
  • -p 2223:22 : expose port 2223 to host, from now on you can SSH into container (short id = d1) with docker_host_ip and port 2223
  • --rm : when stop container ssh-server docker daemon will auto remove from list, even not show in command "ps -a"

Tag summary

Content type

Image

Digest

Size

14.4 MB

Last updated

about 10 years ago

docker pull iatebes/docker-ssh-server