FROM alpine:3.10 ADD ./id_rsa.pub /root/.ssh/authorized_keys RUN apk add --update openssh shadow \ && rm -rf /rmp/* /var/cache/apk/* \ && chown root:root /root/.ssh/authorized_keys \ && chmod 700 /root/.ssh \ && chmod 700 /root/.ssh/authorized_keys \ && mkdir -p /var/run/sshd \ && ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa \ && ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa \ && usermod -p '*' root \ && sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/g' /etc/ssh/sshd_config \ && sed -i 's/GatewayPorts no/GatewayPorts yes/g' /etc/ssh/sshd_config \ && printf "\nMatch User root\n AllowTcpForwarding yes\n X11Forwarding no\n AllowAgentForwarding no\n ForceCommand /bin/false" >> /etc/ssh/sshd_config EXPOSE 22 CMD ["/usr/sbin/sshd","-D"]