php 在docker 中使用composer 报内存溢出的解决方法

最近 需要用到有盟的推送,不想自己写,准备在github上面找个来改改,本地用的环境是docker 镜像,然后在docker 中 composer 时的时候,报了一个错

 docker exec -it www /bin/bash



root@85c8ee9b5e27:/var/www/html/newyouchengdu# composer require lzg-xiyi/umengpush
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^1.0 for lzg-xiyi/umengpush
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

这个很明显的内存溢出错,怎么办,肯定 是改不限制内存

https://stackoverflow.com/questions/49212475/composer-require-runs-out-of-memory-php-fatal-error-allowed-memory-size-of-161

然后找到了解决方案

root@85c8ee9b5e27:/var/www/html/newyouchengdu# php -d memory_limit=-1 /usr/local/bin/composer require lzg-xiyi/umengpush -vvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid

 

posted @ 2020-06-22 17:54  jackluo  阅读(1186)  评论(0编辑  收藏  举报