Correspondence when it becomes killed after composer require in Docker

Aug 24, 2020 PHP Composer Laravel Docker

I made a development environment with Docker (docker-compose) on Mac, and when I made a `composer require` on the Laravel application under development, it was interrupted.
composer require ****/*****
(Omitted)
killed

If composer ends in the middle, I think that lack of memory is a standard thing. I got this link from a senior at the company and the suspicion turned into conviction.

[PHP] Cause and action when composer install fails with killed https://webbibouroku.com/Blog/Article/composer-killed

PHP memory_limit increase

When I found out that there was not enough memory, I first increased the memory_limit of php.ini used in Docker. I didn’t know how much it needed, but for now I made it 2GB (2048MB).

memory_limit = 2048M

After changing the setting, docker build and restart

Increase memory allocation for Docker for Mac

image.png

The resource that Docker specified in Docker for Mac can use was initially 2GB. I have 64GB of memory in my MacBook Pro, so I increased it to Dawn and 8GB. I think this is a consultation with machine specs.

After the change, it took a reboot of the Docker host.

Solved! !!

I changed the memory settings in the above two points and succeeded in executing composer require. The composer update requires a lot of memory as well, so you may need to do the same.