您的位置:首页 > 运维架构 > Docker

使用Dockerfile构建支持SSH等服务的CentOS

2015-12-04 00:00 761 查看
FROM centos

MAINTAINER Arvin.Cao <arvin@caojiawei.com>

RUN yum install --nogpgcheck -y vim openssh openssh-client openssh-server wget curl

RUN mkdir /var/run/sshd

RUN ssh-keygen -q -b 1024 -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key && \

ssh-keygen -q -b 1024 -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key && \

ssh-keygen -q -b 521 -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key && \

ssh-keygen -q -b 521 -N '' -t ed25519 -f /etc/ssh/ssh_host_ed25519_key

RUN sed -i \

-e 's/^#*\(PermitRootLogin\) .*/\1 yes/' \

-e 's/^#*\(PasswordAuthentication\) .*/\1 yes/' \

-e 's/^#*\(PermitEmptyPasswords\) .*/\1 yes/' \

-e 's/^#*\(UsePAM\) .*/\1 no/' \

/etc/ssh/sshd_config

RUN echo 'root:你的密码' |chpasswd

EXPOSE 22

CMD ["/usr/sbin/sshd","-D"]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: