如何通过php系统构建docker镜像()

时间:2017-06-02 10:30:58

标签: php shell docker-build

我正在通过php系统方法()创建一个docker机器,它转到504页面。我的fastcgi_read_timeout尺寸增加了300到6000,max_execution_time增加了300到3000. Stil进入了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 only issue。

建议我在这个配置中错过了什么,并建议我采取任何其他方式来做到这一点。

0 个答案:

没有答案