I am pretty new to Docker, and I am making a simple centOS docker image that can run ssh processes and can also authenticate using ssh keys.
However, when trying to run
ssh [email protected], I get a
ssh: connect to host hostname port 22: Connection refused.
Confused, I tried to see if ssh is actually running by typing in
ssh service status and I got the following error:
System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
I tried running it with the privilege flag but it didn’t do any good. Here is my dockerfile:
FROM centos:latest RUN yum update -y && yum -y install openssh openssh-server openssh-clients sudo initscripts # Generate keys RUN ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key RUN ssh-keygen -q -N "" -t rsa -f /root/.ssh/id_rsa RUN cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
Any help is appreciated. Thank you!
Source: Docker Questions