新增sshd的docker化镜像

This commit is contained in:
KennyLee 2017-04-18 16:04:10 +08:00
parent b2991fcdd3
commit 23ed545504
3 changed files with 43 additions and 0 deletions

27
sshd/Dockerfile Executable file
View File

@ -0,0 +1,27 @@
FROM registry.cn-hangzhou.aliyuncs.com/kennylee/supervisord
MAINTAINER kennylee26 <kennylee26@gmail.com>
# Install.
RUN \
apt-get update && \
apt-get install -y openssh-server && \
rm -rf /var/lib/apt/lists/*
RUN mkdir /var/run/sshd
# Add root password
RUN echo 'root:111111' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 22

9
sshd/README.md Executable file
View File

@ -0,0 +1,9 @@
# sshd
基于 `supervisord` 镜像安装了sshd和初始化配置。
默认远程账号密码为 `root/11111`
鉴于需要添加sshd的容器情景一般都是多应用共用容器的情况所以干脆默认使用 `supervisord` 来管理了,更加方便,合理,适用于扩展。

7
sshd/supervisord.conf Normal file
View File

@ -0,0 +1,7 @@
[supervisord]
nodaemon=true
[program:sshd]
command=/usr/sbin/sshd -D