dongtan7201 2018-07-19 16:31
浏览 1585
已采纳

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

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条回答 默认 最新

  • dongyuling0312 2018-07-19 16:39
    关注

    The easiest way, that works in any Docker-based environment, is to stop and delete the container and run a new one, and it will read its new configuration on startup.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 给我一个openharmony跑通webrtc实现视频会议的简单demo项目,sdk为12
  • ¥15 vb6.0使用jmail接收smtp邮件并另存附件到D盘
  • ¥30 vb net 使用 sendMessage 如何输入鼠标坐标
  • ¥15 关于freesurfer使用freeview可视化的问题
  • ¥100 谁能在荣耀自带系统MagicOS版本下,隐藏手机桌面图标?
  • ¥15 求SC-LIWC词典!
  • ¥20 有关esp8266连接阿里云
  • ¥15 C# 调用Bartender打印机打印
  • ¥15 我这个代码哪里有问题 acm 平台上显示错误 90%,我自己运行好像没什么问题
  • ¥50 C#编程中使用printDocument类实现文字排版打印问题