Dockerfile 631 B

12345678910111213141516171819
  1. FROM daocloud.io/library/ubuntu:18.10
  2. #sources.list添加阿里云镜像
  3. ADD sources.list /root/sources.list
  4. # RUN cp /root/sources.list /etc/apt/sources.list.d/aliyun.list
  5. RUN cp /root/sources.list /etc/apt/sources.list
  6. RUN apt-get update
  7. LABEL Name=github.com/jianboy/ubuntu-ssh Version=18.10
  8. #安装ssh
  9. RUN apt-get install -y openssh-server
  10. RUN mkdir -p /var/run/sshd
  11. #默认用户名密码 root:password
  12. RUN echo 'root:password' | chpasswd
  13. RUN sed -ri 's/^#PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
  14. RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
  15. EXPOSE 22
  16. CMD ["/usr/sbin/sshd", "-D"]