以下のようにすればsshサーバ構築できた。
rootのパスワードは念のためすぐに変更。
authorized_keysは各自生成しておくこと。
FROM centos:centos6
MAINTAINER shotsky
# Install Packages
RUN yum update -y
RUN yum install -y passwd openssh openssh-server openssh-clients sudo
# Setup SSH
RUN mkdir /root/.ssh
RUN chmod 700 /root/.ssh
ADD authorized_keys /root/.ssh/authorized_keys
RUN chmod 600 /root/.ssh/authorized_keys
RUN echo "root:root" | chpasswd
# Mod sshd_config
RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config
RUN sed -i 's/^UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
RUN sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
RUN sed -i 's/^#RSAAuthentication yes/RSAAuthentication yes/g' /etc/ssh/sshd_config
RUN sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config
# Create host rsa&dsa keys
RUN service sshd start
RUN service sshd stop
CMD /usr/sbin/sshd -D