Advertisement
kazoda

Dockerfile httpds

Nov 5th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. # Dockerfile Apache
  2. FROM centos:centos6
  3. MAINTAINER kaz
  4.  
  5. ## yum plugin fastestmirror
  6. RUN echo "prefer=ftp.iij.ad.jp" >> /etc/yum/pluginconf.d/fastestmirror.conf
  7.  
  8. # Time Zone
  9. RUN echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock
  10. RUN rm -f /etc/localtime
  11. RUN ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
  12.  
  13. RUN yum clean all
  14.  
  15. ## Install
  16. #RUN yum groupinstall -y 'Base'
  17. RUN yum install -y sudo openssh-server
  18. RUN yum install -y httpd mod_ssl
  19.  
  20. ## create user
  21. RUN useradd kaz
  22. RUN passwd -u -f kaz
  23. RUN mkdir /home/kaz/.ssh; chown kaz. /home/kaz/.ssh; chmod 700 /home/kaz/.ssh
  24. ADD ./authorized_keys /home/kaz/.ssh/
  25. RUN chown kaz. /home/kaz/.ssh/authorized_keys
  26. RUN chmod 600 /home/kaz/.ssh/authorized_keys
  27.  
  28. ## sudo
  29. RUN echo "kaz ALL=(ALL) ALL" >> /etc/sudoers.d/kaz
  30.  
  31. ## sshd
  32. RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
  33. RUN sed -ri 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config
  34. RUN sed -ri 's/#GSSAPIAuthentication no/GSSAPIAuthentication no/' /etc/ssh/sshd_config
  35. RUN sed -ri 's/GSSAPIAuthentication yes/#GSSAPIAuthentication yes/' /etc/ssh/sshd_config
  36. RUN /etc/init.d/sshd start && sleep 5 && /etc/init.d/sshd stop
  37.  
  38. ##
  39. RUN touch /run.sh
  40. RUN echo -e "#!/bin/bash\n/sbin/service httpd start\n/sbin/service sshd start\n\nwhile true\ndo\n sleep 10\ndone\n" > /run.sh
  41. RUN chmod u+x /run.sh
  42.  
  43. EXPOSE 22 80 443
  44. CMD ["/run.sh"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement