为什么php环境给了777权限,第二天还是没写入权限?

基于docker的thinkphp6环境, 当天给了777权限,但是到第二天还是提示无法创建日志。

dockerfile:

FROM waja/php81-fpm:latest

RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list && \
    rm -Rf /var/lib/apt/lists/* && \
    apt-get update && \
    apt-get install -y curl telnet git zlib1g-dev libzip-dev vim procps libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev && \
    /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' > /etc/timezone && \
    docker-php-ext-install zip pdo pdo_mysql opcache mysqli && \
    docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \
    docker-php-ext-install -j$(nproc) gd && \
    docker-php-ext-install -j$(nproc) bcmath && \
    apt-get install -y nginx supervisor && \
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
    php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
    composer config -g repo.packagist composer https://packagist.phpcomposer.com && \
    php -r "unlink('composer-setup.php');" && \
    
    pecl install redis swoole mongodb && \      
    rm -rf /tmp/pear && \
    docker-php-ext-enable redis swoole mongodb && \
    apt-get clean && rm -rf /var/cache/apt/*
    
COPY ./supervisord.conf /etc/supervisor/

WORKDIR /var/www/html

#EXPOSE 80

CMD ["/usr/bin/supervisord"]

docker-compose(PHP部分):

services:
  php:
    image: touch789/php-fpm:81-supervisor
    privileged: true
    volumes:
      - ./:/var/www/html
      - ./deploy/supervisor/:/etc/supervisor/conf.d/
    networks:
      orders-api-net:
        ipv4_address: 192.168.2.20

php是用supervisor启动的,配置如下:

[program:php-fpm]
command=php-fpm
autostart=true
autorestart=true
startsecs=3
阅读 2.5k
1 个回答

这种一般是定时任务导致的。你查看下你的定时任务,执行的时候的用户是否是 root

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题