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"]