Dockerfile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. FROM centos:centos6.10
  2. MAINTAINER agapple (jianghang115@gmail.com)
  3. env DOWNLOAD_LINK="https://download.oracle.com/otn-pub/java/jdk/8u281-b09/89d678f2be164786b292527658ca1605/jdk-8u281-linux-x64.rpm"
  4. # install system
  5. # update yum config, fix "centos6.x yum install failure && Determining fastest mirrors slow" problems
  6. COPY yum/ /tmp/
  7. RUN \
  8. /bin/cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && \
  9. /bin/cp -f /tmp/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo && \
  10. /bin/cp /etc/yum/pluginconf.d/fastestmirror.conf /etc/yum/pluginconf.d/fastestmirror.conf.bak && \
  11. awk '{ if($0=="enabled=1"){print "enabled=0";} else{print $0;} }' /etc/yum/pluginconf.d/fastestmirror.conf.bak > /etc/yum/pluginconf.d/fastestmirror.conf && \
  12. /bin/cp /etc/yum.conf /etc/yum.conf.bak && \
  13. echo 'minrate=1' >> /etc/yum.conf && echo 'timeout=600' >> /etc/yum.conf && \
  14. yum clean all && yum makecache
  15. RUN \
  16. /bin/cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
  17. echo 'root:Hello1234' | chpasswd && \
  18. groupadd -r admin && useradd -g admin admin && \
  19. yum install -y man && \
  20. yum install -y dstat && \
  21. yum install -y unzip && \
  22. yum install -y nc && \
  23. yum install -y openssh-server && \
  24. yum install -y tar && \
  25. yum install -y which && \
  26. yum install -y wget && \
  27. yum install -y perl && \
  28. yum install -y file && \
  29. ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key && \
  30. ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key && \
  31. sed -ri 's/session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/sshd && \
  32. sed -i -e 's/^#Port 22$/Port 2222/' /etc/ssh/sshd_config && \
  33. mkdir -p /root/.ssh && chown root.root /root && chmod 700 /root/.ssh && \
  34. yum install -y cronie && \
  35. sed -i '/session required pam_loginuid.so/d' /etc/pam.d/crond && \
  36. true
  37. RUN \
  38. touch /var/lib/rpm/* && \
  39. wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" "$DOWNLOAD_LINK" -O /tmp/jdk-8-linux-x64.rpm && \
  40. yum -y install /tmp/jdk-8-linux-x64.rpm && \
  41. /bin/rm -f /tmp/jdk-8-linux-x64.rpm && \
  42. echo "export JAVA_HOME=/usr/java/latest" >> /etc/profile && \
  43. echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile && \
  44. yum clean all && \
  45. true
  46. CMD ["/bin/bash"]