Short Description
centos基础镜像装了一些常用软件主要用来做测试的
Full Description
个人测试用
1.Dockerfile
FROM centos:latest
MAINTAINER becivells <becivells@gmail.com>
RUN yum -y update && yum install -y epel-release
RUN yum install -y supervisor screen net-tools iftop openssl openssh-server nc
#RUN yum groupinstall 'development tools'
RUN mkdir -p /var/log/supervisor &&\
mkdir -p /etc/supervisord.d/
RUN mkdir -p /var/run/sshd &&\
useradd -s /bin/bash -m user &&\
echo "user:123456" | chpasswd &&\
echo "root:123456" | chpasswd &&\
sed -i "s/PermitRootLogin.*/PermitRootLogin no/g" /etc/ssh/sshd_config &&\
mkdir -p /home/user/.ssh/ &&\
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa &&\
ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa &&\
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
#COPY id_rsa.pub /home/user/.ssh/authorized_keys
COPY supervisord.conf /etc/supervisord.conf
COPY sshd.conf /etc/supervisord.d/sshd.conf
COPY sshd_config /etc/ssh/sshd_config
RUN chown user:user -R /home/user/ &&\
chmod 600 /home/user/.ssh/authorized_keys
EXPOSE 22
CMD ["/usr/bin/supervisord","-c","/etc/supervisord.conf"]
2.sshd.conf
[program:sshd]
command=/usr/sbin/sshd -D
autostart = true
autorestart=true
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
3.supervisord.conf
[unix_http_server]
file=/var/run/supervisor/supervisor.sock
[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/var/run/supervisord.pid
[supervisorctl]
serverurl=unix:///var/run/supervisor/supervisor.sock
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[include]
files = supervisord.d/*.conf
4.sshd_config
Port 22
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
PermitRootLogin no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
UsePrivilegeSeparation sandbox
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem sftp /usr/libexec/openssh/sftp-server
Docker Pull Command
Owner
becivells