手动制作ssh服务镜像(基础镜像 CentOS:7 )
首先运行一个CentOS:7基础镜像
docker run -it -p 1022:22 centos:6.9
进入到容器里的操作 更新yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
之后运行yum makecache 生成缓存
下载安装ssh 服务
yum install -y openssh-server
启动ssh服务(会生成三对密钥对)
service sshd start
/etc/init.d/sshd start 6
systemctl start sshd 7