PHP&;Docker:脚本无法写入/tmp


PHP & Docker: script unable to write to /tmp

我用Nginx&我的项目的PHP 5,但由于缺乏/tmp权限,我遇到了一个运行时错误。它必须是一个卷吗?或者有专门的Dockerfile配置吗?

fopen(/tmp/myerror.log): failed to open stream: Permission denied

我不得不添加RUN chmod 777-R/tmp&在过去的中,chmod o+t-R/tmp到我的Dockerfile

chmod 777 (please no ! )
chown -R yourmachinename:yourmachinename /tmp