Laravel Docker storage cache 目录写入失败,而 views 成功,已检查相同权限
重现步骤
docker run -p 8000:80 \
--env APP_NAME="Wifidog Auth" \
--env APP_ENV=local \
--env APP_KEY=base64:silhtn4zkyodaaDIRSU0QEqq4CwKfjdzLqZectaHIi8= \
--env DB_CONNECTION=sqlite \
wifidog/wifidog-auth-laravel:debug
open http://localhost:8000/
curl 'http://localhost:8000/ping?gw_id=001217DA42D2&sys_uptime=742725&sys_memfree=2604&sys_load=0.03&wifidog_uptime=3861'
报错
local.ERROR: file_put_contents(/var/www/laravel/storage/framework/cache/data/37/24/37246234cdba9eafcda0eb4e6953564f4b57fcdf): Failed to open stream: No such file or directory {“exception”:”[object] (ErrorException(code: 0): file_put_contents(/var/www/laravel/storage/framework/cache/data/37/24/37246234cdba9eafcda0eb4e6953564f4b57fcdf): Failed to open stream: No such file or directory at /var/www/laravel/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:133)
检查目录权限
docker ps
docker exec -it xxx bash
ls -la storage/framework/cache/data/
ls -la storage/framework/views/
可以看到 cache 和 views 的权限相同,都是 www-data 755,但 views 成功写入了临时文件,而 cache 没有。
代码
Dockerfile
: github.com/wifidog/wifidog-auth-la...
启动脚本:
github.com/wifidog/wifidog-auth-la...
推荐文章: