Skip to content

Instantly share code, notes, and snippets.

@timusg
Created December 4, 2013 16:19
Show Gist options
  • Save timusg/7790418 to your computer and use it in GitHub Desktop.
Save timusg/7790418 to your computer and use it in GitHub Desktop.
configure SSH server on docker CentOS base image
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