我如何授予php-fpm容器权限以将文件写入目录?
docker-compose.yml文件:
version: '3'
services:
web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/default.conf
- ./logs:/var/log/nginx
restart: always
depends_on:
- php
php:
image: bitnami/php-fpm:7.1
volumes:
- ./custom.ini:/opt/bitnami/php/etc/conf.d/custom.ini
- ./code:/code
db:
image: postgres:10.1
restart: always
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
ports:
- 5400:5432
当docker-compose启动时,我尝试运行我的代码,但是出现一个错误,提示php没有写文件的权限:
PHP message: PHP Warning: mkdir(): Permission denied in /code/vendor/yiisoft/yii2/helpers/BaseFileHelper.php on line 624" while reading upstream, client: 10.0.2.2, server: , request: "GET / HTTP/$
2018/11/24 09:35:25 [error] 6#6: *2 FastCGI sent in stderr: "PHP message: An Error occurred while handling another error:
yii\base\InvalidConfigException: The directory is not writable by the Web process: /code/assets/runtime in /code/vendor/yiisoft/yii2/web/AssetManager.php:215