构建centos sshd
This commit is contained in:
parent
02a770a6c9
commit
769e2ad1a6
@ -0,0 +1,16 @@
|
||||
FROM centos:7
|
||||
|
||||
MAINTAINER Yang <yangyufans@qq.com>
|
||||
|
||||
RUN yum install -y passwd openssl openssh-server openssh-clients
|
||||
|
||||
RUN ssh-keygen -q -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N '' && \
|
||||
ssh-keygen -q -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' && \
|
||||
ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key -N ''
|
||||
|
||||
RUN sed -i "s/UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config && \
|
||||
sed -i "s/UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config
|
||||
|
||||
RUN echo "123456" | passwd --stdin root
|
||||
|
||||
ENTRYPOINT ["/usr/sbin/sshd","-D"]
|
||||
25
sshd/centos/README.md
Normal file
25
sshd/centos/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# centos sshd 搭建
|
||||
## 创建镜像
|
||||
镜像构建源码请[参考](http://git.yangyufans.com/pub/docker/tree/master/sshd/centos)
|
||||
|
||||
进入相应的nginx版本,执行以下命令
|
||||
```bash
|
||||
docker build -t ccr.ccs.tencentyun.com/yy-dk/centos-sshd:7.0 .
|
||||
```
|
||||
## 从远程仓库下载
|
||||
|
||||
```bash
|
||||
docker pull ccr.ccs.tencentyun.com/yy-dk/centos-sshd:7.0
|
||||
```
|
||||
## 创建网络
|
||||
```bash
|
||||
docker network create -d bridge --subnet 172.10.0.0/24 --gateway 172.10.0.1 my_net
|
||||
```
|
||||
## 启动容器
|
||||
```bash
|
||||
docker run -d \
|
||||
--network my_net \
|
||||
--ip 172.10.0.4 \
|
||||
--name centos-sshd \
|
||||
ccr.ccs.tencentyun.com/yy-dk/centos-sshd:7.0
|
||||
```
|
||||
Loading…
Reference in New Issue
Block a user