# centos7SSHDv1.0 FROM centos:7 RUN yum install -y lftp wget RUN mv /etc/yum.repos.d/*.repo /tmp
&& echo -e "[ftp] name=ftpbase baseurl=ftp://172.17.0.1/pub enabled=1 gpgcheck=0 ">/etc/yum.repos.d/ftp.repo RUN wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm && rpm -ivh mysql-community-release-el7-5.noarch.rpm RUN yum install -y vim net-tools openssh-server* httpd php php-mysql wget mysql-server mysql ADD init.sh / ADD Discuz.tar.gz /var/www/ RUN chmod 777 -R /var/www/html RUN chmod +x /init.sh &&sed -i "s/UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config &&sed -i "s/#UseDNS.*/UseDNS no/g" /etc/ssh/sshd_config &&sed -i "s/GSSAPIAuthentication.*/GSSAPIAuthentication no/g" /etc/ssh/sshd_config &&echo 【xxxx】 |passwd root --stdin RUN sed -i "s/AddDefaultCharset UTF-8/AddDefaultCharset GB2312/g" /etc/httpd/conf/httpd.conf RUN systemctl enable sshd mysqld httpd CMD ["/usr/sbin/init","/init.sh"] EXPOSE 22 EXPOSE 3306 EXPOSE 80
[root@test2 CentOSLAMP]# cat init.sh
#!/bin/bash
systemctl restart mysqld
mysql -e "GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '123qwe';GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY '123qwe';delete from mysql.user where user = '';delete from mysql.user where password='';create database d;GRANT ALL ON d.* TO 'd'@'%' IDENTIFIED BY '123456';flush privileges;"
docker image build -t "c1:v1" ./