PHP 和 Docker:脚本无法写入 /tmp

vin*_*nux 5 php docker

我已经为我的项目使用 Nginx 和 PHP 5 创建了一个 Docker 映像,但由于缺乏 /tmp 的权限,我收到了运行时错误。它是否必须是一个卷,或者是否有一个特殊的 Dockerfile 配置?

fopen(/tmp/myerror.log): failed to open stream: Permission denied
Run Code Online (Sandbox Code Playgroud)

Eri*_*uff 5

我过去必须将 RUN chmod 777 -R /tmp && chmod o+t -R /tmp 添加到我的 Dockerfile 中