docker pull mysql:5.7 #port 號及 password docker run -d --name mysql -p 3344:3306 -e MYSQL_ROOT_PASSWORD=123 mysql:5.7
docker start mysql #進入修改為非嚴格模式 docker exec -it mysql bash echo sql_mode=NO_ENGINE_SUBSTITUTION >> /etc/mysql/mysql.conf.d/mysqld.cnf
docker pull mariadb:latest
docker run -d --name MariaDB -p 3344:3306 -v ~/git/mariadb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123 mariadb:latest
docker pull skiychan/nginx-php7:latest docker run --name nginx -v ~/git/www/htdocs:/data/wwwroot -p 8080:80 -d skiychan/nginx-php7
FROM ubuntu:latest MAINTAINER prolin99@gmail.com ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install -y software-properties-common language-pack-en-base sed RUN LC_ALL=en_US.UTF-8 add-apt-repository -y -u ppa:ondrej/php RUN apt-get update && \ apt-get install -y apache2 libapache2-mod-php7.1 php7.1-bcmath php7.1-bz2 php7.1-cli php7.1-common php7.1-curl php7.1-dba php7.1-gd php7.1-gmp php7.1-imap php7.1-intl php7.1-ldap php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-odbc php7.1-pgsql php7.1-recode php7.1-snmp php7.1-soap php7.1-sqlite php7.1-tidy php7.1-xml php7.1-xmlrpc php7.1-xsl php7.1-zip RUN sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 256M/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/post_max_size = 8M/post_max_size = 512M/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/memory_limit = 128M/memory_limit = 512M/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/;date.timezone =/date.timezone = Asia\/Taipei/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/display_errors = Off/display_errors = On/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/max_file_uploads = 20/max_file_uploads = 300/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/max_input_time = 60/max_input_time = 120/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/; max_input_vars = 1000/max_input_vars = 5000/g' /etc/php/7.1/apache2/php.ini && \ sed -i -e 's/DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm/DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm/g' /etc/apache2/mods-available/dir.conf # Enable apache mods. RUN a2enmod php7.1 RUN a2enmod rewrite # Manually set up the apache environment variables ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOCK_DIR /var/lock/apache2 ENV APACHE_PID_FILE /var/run/apache2.pid # Expose apache. EXPOSE 80 # Update the default apache site with the config we created. #ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf # By default start up apache in the foreground, override with /bin/bash for interative. CMD /usr/sbin/apache2ctl -D FOREGROUND
docker build -t prolin/php71 .
docker run --name php71 -v ~/git/x28:/var/www/html -p 8080:80 -d prolin/php71 docker start php71