使用dockerfile 创建ubuntu ssh镜像

############################################################
# Dockerfile to build ubunto ssh container images
# Based on Ubuntu
############################################################

FROM ubuntu

MAINTAINER jinyetongxiao

ENV TZ Asia/Shanghai
ENV LANG zh_CN.UTF-8

RUN sed -i 's#http://archive.ubuntu.com/#http://cn.archive.ubuntu.com/#' /etc/apt/sources.list

RUN apt-get update && 
apt-get -y install vim && 
apt-get -y install openssh-server && 
apt-get clean && 
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*

RUN echo 'root:root' |chpasswd

RUN sed -ri 's/^PermitRootLogins+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config

RUN mkdir /var/run/sshd

EXPOSE 22

#Start ssh Service
CMD ["/usr/sbin/sshd", "-D"]
原文地址:https://www.cnblogs.com/befer/p/8379788.html