Sunday, 30 September 2018

Setting up PHP-FPM, Nginx, Mariadb on CentOs using docker

I'm trying to move from from using VirtualBox as my development environment to docker.

With VirtualBox, I mainly install PHP-FPM, Nginx and Mariadb but in Docker, I can't replicate the same stack despite trying for some days.

Out of all the LEMP/LAMP stack docker guides, only this one chentex/docker-nginx-centos works for me:

Here is the code from the Dockerfile

FROM centos:centos7
LABEL maintainer="Vicente Zepeda <chente.z.m@gmail.com>"

ENV nginxversion="1.12.2-1" \
    os="centos" \
    osversion="7" \
    elversion="7_4"

RUN yum install -y wget openssl sed &&\
    yum -y autoremove &&\
    yum clean all &&\
    wget http://nginx.org/packages/$os/$osversion/x86_64/RPMS/nginx-$nginxversion.el$elversion.ngx.x86_64.rpm &&\
    rpm -iv nginx-$nginxversion.el$elversion.ngx.x86_64.rpm &&\
    sed -i '1i\
    daemon off;\
    ' /etc/nginx/nginx.conf

CMD ["nginx"]

This works right out of the box, and I can see a default page on http://localhost

The only problem is that, it does not contain PHP-FPM and Mariadb.

I tried to alter the file and add PHP-FPM and Mariadb, but I found out on reddit that each container should have on service, as in one container for nginx, and another for php ... and I'm lost on how to make that



from Setting up PHP-FPM, Nginx, Mariadb on CentOs using docker

No comments:

Post a Comment