#Dockerfile FROM ubuntu:14.04 MAINTAINER gaogd<[email protected]> RUN rm -rf /var/lib/apt/lists RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak ADD sources.list /etc/apt/sources.list RUN apt-get clean RUN apt-get update RUN apt-get install -y openjdk-7-jdk RUN apt-get install -y openssh-server RUN apt-get install -y vim tree lrzsz RUN echo ‘root:[email protected]‘ |chpasswd RUN useradd -m ubuntu -s /bin/bash RUN echo "ubuntu:[email protected]" | chpasswd RUN echo "ubuntu ALL=(ALL) ALL" >> /etc/sudoers ADD sshd_config /etc/ssh/sshd_config WORKDIR /home/ubuntu/ USER ubuntu RUN pwd;ls -a; RUN mkdir /home/ubuntu/.ssh RUN ssh-keygen -t rsa -P ‘‘ -f /home/ubuntu/.ssh/id_rsa ADD authorized_keys /home/ubuntu/.ssh/authorized_keys USER root RUN chmod 600 /home/ubuntu/.ssh/authorized_keys ;chown -R ubuntu.ubuntu /home/ubuntu/ RUN mkdir /var/run/sshd RUN sed -ri ‘s/^PermitRootLogin\s+.*/PermitRootLogin yes/‘ /etc/ssh/sshd_config RUN sed -ri ‘s/UsePAM yes/#UsePAM yes/g‘ /etc/ssh/sshd_config CMD ["/usr/sbin/sshd","-D"] EXPOSE 4021
时间: 2024-10-20 18:59:21