Advertisement
kazoda

Dockerfile (sshd,httpd)

Jul 24th, 2014
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. FROM centos:centos6
  2. MAINTAINER kaz
  3.  
  4. ## yum plugin fastestmirror
  5. RUN echo "prefer=ftp.iij.ad.jp" >> /etc/yum/pluginconf.d/fastestmirror.conf
  6.  
  7. ## Install
  8. RUN yum groupinstall -y 'Base'
  9. RUN yum install -y sudo openssh-server
  10. RUN yum install -y httpd
  11. RUN yum install -y yum-plugin-priorities.noarch
  12. RUN rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/i386/epel-release-6-8.noarch.rpm
  13. RUN yum install -y supervisor
  14.  
  15. ## create user
  16. RUN useradd kaz
  17. RUN passwd -u -f kaz
  18. RUN mkdir /home/kaz/.ssh; chown kaz. /home/kaz/.ssh; chmod 700 /home/kaz/.ssh
  19. ADD ./authorized_keys /home/kaz/.ssh/
  20. RUN chown kaz. /home/kaz/.ssh/authorized_keys
  21. RUN chmod 600 /home/kaz/.ssh/authorized_keys
  22.  
  23. ## sudo
  24. RUN echo "kaz ALL=(ALL) ALL" >> /etc/sudoers.d/kaz
  25.  
  26. ## sshd
  27. RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
  28. RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
  29. RUN sed -ri 's/#GSSAPIAuthentication no/GSSAPIAuthentication no/' /etc/ssh/sshd_config
  30. RUN sed -ri 's/GSSAPIAuthentication yes/#GSSAPIAuthentication yes/' /etc/ssh/sshd_config
  31. RUN /etc/init.d/sshd start
  32. RUN /etc/init.d/sshd stop
  33.  
  34. ## supervisor
  35. RUN sed -ri 's/nodaemon=false/nodaemon=true/g' /etc/supervisord.conf
  36. RUN echo -e "[program:sshd]\ncommand=/usr/sbin/sshd -D\nautostart=true\nautorestart=true\n" >> /etc/supervisord.conf
  37. RUN echo -e "[program:httpd]\ncommand=/bin/bash -c 'source /etc/sysconfig/httpd && exec /usr/sbin/httpd -DFOREGROUND'\n" >> /etc/supervisord.conf
  38.  
  39. EXPOSE 22 80
  40. CMD ["/usr/bin/supervisord"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement