Docker Centos SSHD服务 Dockerfile
# Pull base image
FROM centos:latest
MAINTAINER crabdave "calorie.david@gmail.com"
# Usage: USER [UID]
USER root
# modify timezone
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN yum install passwd openssl openssh-server sudo -y
RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
RUN echo "root:david" | chpasswd
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN mkdir /var/run/sshd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
参考: