docker-compose部署lnmp环境

Posted caidingyu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker-compose部署lnmp环境相关的知识,希望对你有一定的参考价值。

docker-compose.yml配置文件如下

version: "2"
services:
  nginx:
    image: nginx:alpine
    container_name: my-nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./conf/nginx/conf.d/:/etc/nginx/conf.d/:ro
      - ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./log/nginx/:/var/log/nginx/:rw
      - ./www/:/var/www/:rw
    networks:
      - net-php

  php:
    build: ./php/php56/
    expose:
      - "9000"
    volumes:
      - ./conf/php/php.ini:/etc/php/php.ini:ro
      - ./conf/php/php-fpm.conf:/etc/php/php-fpm.conf:ro
      - ./log/php/:/var/log/php/:rw
      - ./www/:/var/www/:rw
    networks:
      - net-php


networks:
  net-php:

 php5.6 Dockerfile如下

FROM alpine:3.3

RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.3/main" > /etc/apk/repositories

ENV TIMEZONE Asia/Shanghai

RUN apk update &&   apk add --no-cache tzdata &&   cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime &&   echo "${TIMEZONE}" > /etc/timezone &&   apk add php-intl     php-mcrypt     php-openssl     php-gmp     php-json     php-dom     php-pdo     php-zip     php-zlib     php-mysqli     php-bcmath     php-gd     php-xcache     php-pdo_mysql     php-gettext     php-xmlreader     php-xmlrpc     php-bz2     php-memcache     php-iconv     php-curl     php-ctype     php-fpm     php-phar     php &&   apk del tzdata &&   rm -rf /var/cache/apk/*
RUN set -x   && addgroup -g 82 -S www-data   && adduser -u 82 -D -s /sbin/nologin -h /var/www -G www-data www-data
RUN mkdir /var/log/php   && chown -R www-data:www-data /var/log/php   && chmod -R 774 /var/log/php

EXPOSE 9000
CMD ["php-fpm", "-F"]

  

以上是关于docker-compose部署lnmp环境的主要内容,如果未能解决你的问题,请参考以下文章

使用docker-compose安装Nextcloud

使用docker-compose安装Nextcloud

DockerFile部署lnmp+memcached+redis+mongodb开发环境for MongoDB

DockerFile部署lnmp+memcached+redis+mongodb开发环境for MySQL

DockerFile部署lnmp+memcached+redis+mongodb开发环境for Redis

DockerFile部署lnmp+memcached+redis+mongodb开发环境for Nginx