我在数字海洋里有一朵云,它有1GB的内存。我需要安装一个码头,laravel,mysql,nginx环境,我找到了laradock并正常安装了它,但是在容器中运行composer时,我返回了一个内存限制错误。
运行错误: composer安装
root@b9864446a1e1:/var/www/site# composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 677388288) (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
Fatal error: Out of memory (allocated 677388288) (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
试图更改内存时出错。
警告:您的内核不支持交换限制功能,或者没有挂载cgroup。内存有限,没有交换。
发布于 2020-02-17 06:05:11
这可能是因为VPS耗尽了内存,而且没有启用交换空间的。
free -m
total used free shared buffers cached
Mem: xxxx xxx xxxx x x xxx
-/+ buffers/cache: xxx xxxx
Swap: 0 0 0
要启用可以使用的交换空间,例如:
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
您可以在本教程来自DigitalOcean之后创建一个永久交换文件。
https://stackoverflow.com/questions/60263830
复制相似问题