Docker build php-fpm IMages (dockerfile)

Source: Internet
Author: User
Tags fpm docker run

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.