基于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
这种一般是定时任务导致的。你查看下你的定时任务,执行的时候的用户是否是 root