mirror of
https://gitee.com/kennylee/docker.git
synced 2024-12-01 19:38:30 +08:00
新增sshd的docker化镜像
This commit is contained in:
parent
b2991fcdd3
commit
23ed545504
27
sshd/Dockerfile
Executable file
27
sshd/Dockerfile
Executable 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
9
sshd/README.md
Executable file
@ -0,0 +1,9 @@
|
||||
# sshd
|
||||
|
||||
基于 `supervisord` 镜像,安装了sshd和初始化配置。
|
||||
|
||||
默认远程账号密码为 `root/11111`
|
||||
|
||||
鉴于需要添加sshd的容器情景一般都是多应用共用容器的情况,所以干脆默认使用 `supervisord` 来管理了,更加方便,合理,适用于扩展。
|
||||
|
||||
|
7
sshd/supervisord.conf
Normal file
7
sshd/supervisord.conf
Normal file
@ -0,0 +1,7 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:sshd]
|
||||
command=/usr/sbin/sshd -D
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user