我正在通过 php system method() 构建一个 docker 机器,它转到 504 页面。我已将fastcgi_read_timeout
300 号增加到 6000号,max_execution_time
将 300 号增加到 3000 号。仍然转到 504 页。
我的代码: mybuild.php
$docker_pull = system("cd $this->script_path/;sudo docker build -t reports .", $ret);
if ($docker_pull != null) {
print "efk Image pulled correctly";
} else {
echo "Error! While docker Pull";
}
此代码通过运行命令行工作:
php mybuild.php $ag1 $ag2
但是我通过 php 文件调用的同一个文件在 mytest.php 中不起作用:
system("/usr/bin/php mybuild.php $arg1 $agrg2")
为什么?
我添加www-data ALL=NOPASSWD: /usr/bin/docker
到 /etc/sudoers 文件中。
注意: docker 容器创建正常,但 docker build 仅问题。
建议我在此配置中错过的内容,并建议我以其他任何方式执行此操作。