重启计算机后Docker失败

时间:2018-08-07 11:44:04

标签: docker-compose api-platform.com

我在api平台的投放方面遇到问题。我正在构建一个可以正常工作的API,直到必须重新启动计算机。然后,当我尝试使用docker-compose up -d重新启动服务器时,某些容器崩溃了(请参阅下面的docker-composer ps n°1)。

我已经重新安装了api-platform并将所有旧代码放入其中,并且可以很好地工作,直到计算机重新启动为止。

当我执行docker-composer重启时,崩溃的2个容器是“ api-platform-230_copie1_cache-proxy_1”和“ api-platform-230_copie1_php_1”(请参阅​​docker-compose ps n°2)

cache_proxy_1的docker日志是:

mathieu:api-platform-2.3.0_copie1 Mathieu$ docker logs api-platform-230_copie1_cache-proxy_1
+ varnishd -a :80 -f /etc/varnish/default.vcl -s malloc,256m
Error:
Message from VCC-compiler:
Backend host '"api"' could not be resolved to an IP address:
	Name does not resolve
(Sorry if that error message is gibberish.)
('/etc/varnish/default.vcl' Line 6 Pos 11)
  .host = "api";
----------#####-

Running VCC-compiler failed, exited with 2
VCL compilation failed
+ varnishd -a :80 -f /etc/varnish/default.vcl -s malloc,256m
Error:
Message from VCC-compiler:
DNS lookup(php): Name does not resolve
('/etc/varnish/default.vcl' Line 21 Pos 3)
  "php";
--#####-

Running VCC-compiler failed, exited with 2
VCL compilation failed
+ varnishd -a :80 -f /etc/varnish/default.vcl -s malloc,256m
Error:
Message from VCC-compiler:
DNS lookup(php): Name does not resolve
('/etc/varnish/default.vcl' Line 21 Pos 3)
  "php";
--#####-

Running VCC-compiler failed, exited with 2
VCL compilation failed
+ varnishd -a :80 -f /etc/varnish/default.vcl -s malloc,256m
Debug: Platform: Linux,4.9.93-linuxkit-aufs,x86_64,-junix,-smalloc,-smalloc,-hcritbit
Debug: Child (19) Started
+ varnishlog
+ varnishd -a :80 -f /etc/varnish/default.vcl -s malloc,256m
Error:
Message from VCC-compiler:
DNS lookup(php): Name does not resolve
('/etc/varnish/default.vcl' Line 21 Pos 3)
  "php";
--#####-

Running VCC-compiler failed, exited with 2
VCL compilation failed

php_1的docker日志是:

mathieu:api-platform-2.3.0_copie1 Mathieu$ docker logs api-platform-230_copie1_php_1
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - Installation request for phpoffice/phpspreadsheet 1.4.0 -> satisfiable by phpoffice/phpspreadsheet[1.4.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/php.ini
    - /usr/local/etc/php/conf.d/05-opcache.ini
    - /usr/local/etc/php/conf.d/20-apcu.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - Installation request for phpoffice/phpspreadsheet 1.4.0 -> satisfiable by phpoffice/phpspreadsheet[1.4.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/php.ini
    - /usr/local/etc/php/conf.d/05-opcache.ini
    - /usr/local/etc/php/conf.d/20-apcu.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - Installation request for phpoffice/phpspreadsheet 1.4.0 -> satisfiable by phpoffice/phpspreadsheet[1.4.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/php.ini
    - /usr/local/etc/php/conf.d/05-opcache.ini
    - /usr/local/etc/php/conf.d/20-apcu.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - Installation request for phpoffice/phpspreadsheet 1.4.0 -> satisfiable by phpoffice/phpspreadsheet[1.4.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/php.ini
    - /usr/local/etc/php/conf.d/05-opcache.ini
    - /usr/local/etc/php/conf.d/20-apcu.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - phpoffice/phpspreadsheet 1.4.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - Installation request for phpoffice/phpspreadsheet 1.4.0 -> satisfiable by phpoffice/phpspreadsheet[1.4.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/php.ini
    - /usr/local/etc/php/conf.d/05-opcache.ini
    - /usr/local/etc/php/conf.d/20-apcu.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

您对这个问题有想法吗?

我不是真正的开发人员,我是心脏病专家,所以请放纵

我在localhost中。我正在使用Mac和api平台的最新版本(2.3.0)

最后,我不知道如何在docker和api平台上正确安装捆绑软件,因此我直接在api目录中使用composer.phar进行安装。可能是问题的根源吗?

谢谢

docker-compose ps n°1

docker-compose ps n°2

1 个答案:

答案 0 :(得分:0)

我认为问题出在“ yectep / phpspreadsheet-bundle”的安装上。我重新安装api平台,安装composer.phar,更新“ symfony / flex”,安装“ symfony / dotenv”,一切正常,直到我安装了“ yectep / phpspreadsheet-bundle”。 我的问题是知道如何在没有此捆绑包的情况下将数据(超过100000个条目)从Excel传输到我的数据库,但这是另一个问题!