docker下LNMP环境的搭建

  1. mysql镜像下载
docker pull mysql
  1. nginx镜像下载
docker pull nginx
  1. php镜像定制,以下为Dockerfile
FROM library/php:7.4-fpm
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && pecl channel-update pecl.php.net && apt-get install -y tar && apt-get install -y libpcre3-dev \
     && docker-php-ext-install -j$(nproc) bcmath mysqli pdo_mysql \
     && pecl install psr && pecl install igbinary && pecl install redis && pecl install phalcon \
     && echo 'extension=psr.so' > /usr/local/etc/php/conf.d/psr.ini \
     && echo 'extension=igbinary.so' > /usr/local/etc/php/conf.d/igbinary.ini \
     && echo 'extension=redis.so' > /usr/local/etc/php/conf.d/redis.ini \
     && echo 'extension=phalcon.so' > /usr/local/etc/php/conf.d/phalcon.ini \
     && cd /usr/local/etc/php && cp php.ini-development php.ini \
     && docker-php-source delete && pecl clear-cache
  1. 生成新的php镜像
docker build -f Dockerfile -t david/php:7.4-fpm
  1. LNMP启动脚本,docker-compose.yml如下:
正在调试中

你可能感兴趣的:(docker下LNMP环境的搭建)