Jun 20, 2017

Using sshd in a docker container by the help of supervisord

On my windows box, I'm running docker-toolbox.

In one container started by docker-compose with a database container, I need ssh access, to use
e.g. WinSCP to copy files for testing inside the container.

In the Dockerfile, I used CentOS as the base image and installed open-ssh-server

RUN yum -y update
RUN yum -y install rpm ksh openssh-server supervisor compat-libstdc++-33 compat-libstdc++-296 libstdc++ glibc.i686 libgcc.i686 tar python-setuptools mariadb unzip dos2unix
RUN easy_install supervisor
#configure supervisor as process starter
ADD ./supervisor.conf/  /etc/supervisord.d/
COPY id_rsa.pub /root/.ssh/authorized_keys
RUN chmod go-rwx /root.ssh; chmod go-rwx /root/.ssh/authorized_keys
RUN cd /etc/ssh; ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

Before I added the ssh-keygen to the container, I tried to access the ssh-Daemon, but I got the 
error in debug-Mode of sshd:
No supported key exchange algorithms
After adding the ssh-keygen, I can login with e.g WinSCP. 

Here's the ssh.ini to add to the supervisord-config: 

command=/usr/sbin/sshd -D