Long time did not write the blog to do what? Review Nginx Zabbix docker-compos mariadb Learn Jenkins ansible ELK k8s (kubeadm) OK also should calm down to tidy up! Okay, I'm not talking about the demo .
See the public number one recently: a single nginx image tailored for multiple php-fpm containers
I just wanted to get a php-fpm image to set up a lnmp, but I was willing to docker,hub Docker Stroe. Ari like tossing for several hours is not nginx php-fpm is nginx ph-fpm MySQL all dozen into a images or is PHP not php-mysql no language, heart tired, can not find their favorite image to have their own hands to build PHP-FPM Images
Prepare the Environment
Host (172.16.0.66) has compiled nginx PHP
Nginx-1.14/usr/local/nginx
php-5.3.29/usr/local/php (1: Base image Yum extension PHP module, GD, Php-mysql 2: Host build PHP 3: Consolidate base image and compile complete source package)
MARIADB 172.16.0.30:3306
Project/usr/www/html (Website configuration file has been modified by connect DB)
Docker version 17.05.0-ce
Implementation method:
Host start Nginx, connection mode in the container php, PHP connection backend DB mariadb 172.16.0.30:3306 database has been imported
Dockerfile
# This is a commitfrom ansible/centos7-ansible:latest Maintainer Love coding<2373673@qq .com>USER Rootrun Groupadd-G +www RUN useradd-u1001-g www-s/bin/Bash WwwrunYum Install-Y Supervisor Libcurl Curl-develbzip2 bzip2-devel openssl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-develGCC MakeLibmcrypt-devel &&YumClean all &&RM-rf/var/cache/Yum/*RUN mkdir-p/usr/www/html && chown-r www:www/usr/www/html && mkdir-p/usr/localcopy php/usr/l ocal/php RUN cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf &&chmod-r O+x/usr/lo Cal/phpcopy supervisord.conf/etc/supervisord.confrun chown-r www:www/usr/local/php && sed-i "s/127.0.0.1/0.0 .0.0/g "/usr/local/php/etc/php-fpm.confexpose 9000#cmd ["/USR/LOCAL/PHP-FPM/SBIN/PHP-FPM "]ENTRYPOINT ["/usr/bin/ Supervisord ","-C ","/etc/supervisord.conf "]
Vim/etc/supervisord.conf
[SUPERVISORD]NODAEMON=TRUE[PROGRAM:PHP-FPM]COMMAND=/USR/LOCAL/PHP/SBIN/PHP-FPM
Docker build-it Php-fpm:v6.
Docker run-d-P 9000:9000--name php-fpm-api-v/usr/www/html:/usr/www/html php-fpm:v6 #运行php-fpm Container
/usr/local/nginx/sbin/nginx #宿主机运行nginx
Docker build php-fpm IMages (dockerfile)