使用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"]
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"]
相关文章推荐
- docker 笔记
- docker安装完成后碰到如下警告:bridge-nf-call-iptables is disabled
- Docker+nginx+tomcat7配置简单的负载均衡
- Windows上访问虚拟机上的docker容器
- 搞搞阿里云 及 centos7.0 成功安装docker
- 关于 centos下docker安装中遇到的问题 小小吐嘈一下下
- 联想企业云docker开发实践
- docker for mac
- Docker vs Vagrant
- OpenStack里使用Nova Docker Driver需要注意的细节
- Docker命令行探秘
- docker的使用
- 使用Docker快速部署Storm环境
- docker 中 NGINX+PHP+MYSQL+REDIS+Elasticsearch 环境搭建 (windows系统)
- Docker搭建便捷的开发者环境
- 如何构建Memcached Docker容器
- Docker 监控- Prometheus VS Cloud Insight
- Docker 监控- Prometheus VS Cloud Insight
- 分布式应用中网络故障和分区的docker测试框架Blockade
- Docker Swarm系统结构图