dongtan7201
dongtan7201
2018-07-19 16:31

如何在docker容器中重新加载服务配置(php-fpm)?

  • php
  • docker

I need to run php-fpm with root user.

I'm following steps on this page Start PHP-FPM with root option automatically but it looks like systemd and systemctl are not inluded in my baseimage ubuntu:16.04 then I can't reload service configuration.

Then how to proceed else ? Today, i'm installing apache/php-fpm in the same container.

Thanks in advance.

Dockerfile :

FROM ubuntu:16.04

# Installer Nano / Apache2
RUN apt-get update && apt-get install -y \
    apt-utils \
    nano \
    apache2

# Activer le module Apache mod_proxy_fcgi
RUN a2enmod proxy_fcgi

# Activer le module Apache mod_rewrite
RUN a2enmod rewrite

# Installation PHP + extensions / composer
RUN apt-get install -y \
    php-fpm \
    php-mcrypt \
    php-mysql \
    php-apcu \
    php-curl \
    php-intl \
    php-xdebug \
    php-xml \
    php-zip \
    php-bcmath \
    php-gd \
    php-json \
    php-ldap \
    php-mbstring \
    php-mysql \
    php-pgsql \
    php-sqlite3 \
    php-xml \
    php-xsl \
    php-zip \
    php-soap \
    php-opcache \
    composer

# Creation dossier php pour pid/socket php-fpm
RUN mkdir /run/php

# Activer config
RUN a2enconf php7.0-fpm

EXPOSE 80

VOLUME /var/www/html
WORKDIR /var/www/html

# Clean up APT when done.
RUN apt-get clean

My docker-compose file :

version: '2'

services:
    apachephp:
        container_name: monserveur
        image: toto/apache2_php-fpm7.0.30:0.4
        ports:
            - "80:80"
        volumes:
            - D:\projets\lab.magento225:/var/www/html
        links:
            - db:db
        tty: true
    db:
        container_name: mabdd
        image: mysql:5.6
        ports:
            - "3306:3306"
        volumes:
            - D:\local.databases\lab.magento225:/var/lib/mysql
        environment:
            - MYSQL_ROOT_PASSWORD=root
    pma:
        container_name: phpmyadmin
        image: phpmyadmin/phpmyadmin
        ports:
            - "8080:80"
        links:
            - db:db

</div>
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答