Created
December 4, 2013 16:19
-
-
Save timusg/7790418 to your computer and use it in GitHub Desktop.
configure SSH server on docker CentOS base image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos | |
RUN yum install -y sudo openssh-server openssh-clients | |
RUN yum install -y passwd | |
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config | |
RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config | |
# fix for ssh connection issue | |
RUN ssh-keygen -b 1024 -t rsa -f /etc/ssh/ssh_host_key | |
RUN ssh-keygen -b 1024 -t rsa -f /etc/ssh/ssh_host_rsa_key | |
RUN ssh-keygen -b 1024 -t dsa -f /etc/ssh/ssh_host_dsa_key | |
# fix for bash: /dev/fd/X: No such file or directory | |
RUN ln -s /proc/self/fd /dev/fd | |
RUN echo -e "NEWPASS\nNEWPASS" | passwd | |
EXPOSE 22 | |
ENTRYPOINT /usr/sbin/sshd -D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment