Problem

When I tried to install the aws s3 adapter in my laravel project, I went into the docker container and ran composer require league/flysystem-aws-s3-v3 ~1.0 and it was killed as follows.

root@9f833b0a116f:/var/www/html/laravel# composer require league/flysystem-aws-s3-v3 ~1.0

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

Killed

Pls don’t kill it… I want to complete the installation of this without getting killed.

TL;DR

Increase the memory allocation of Docker for Mac as much as possible.

Solution

What I found

First, I checked when Killed is triggered.
This seems to be a behavior called OOM Killer.

 OOM Killer (Out of Memory Killer) is a mechanism in the Linux kernel that kills processes to free up memory when the system has used up all of its real and virtual memory space (swap space) and cannot allocate the necessary memory space. Killer is provided to avoid the worst-case scenario where the system itself stops due to inability to allocate free memory.
(translated)

日経XTECH

It seems that the forced kill of the process is the result of OOM Killer’s work to prevent the system itself from stopping.
In other words, the cause this time was lack of memory.

In Docker for mac, I looked at Preferences > Resources > Memory and found that I currently have 3.75GB allocated, and Swap is 1GB.
In addition, I checked the memory used by docker in the Mac’s Activity Monitor, and found that it was using up almost all of the allocated memory.

What I tried

I went to Preferences > Resources > Memory in Docker for mac and increased the allocated memory as much as I could.
The mac itself is 16GB, so I decided to take a look at it and increase it to 5GB.

Once again, I ran composer require league/flysystem-aws-s3-v3 ~1.0.

root@9f833b0a116f:/var/www/html/laravel# composer require league/flysystem-aws-s3-v3
Using version ^1.0 for league/flysystem-aws-s3-v3

~~~

Package manifest generated successfully.
38 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

it worked well:)

What I thought

In this case, 5GB was enough, but if you’re working on several projects, for example, and you’re constantly setting up several Docker containers on, you’ll probably end up allocating memory and then eating it up.
I tend to set up containers with restart: always from the time of development, but it might be better to take measures such as dropping containers that are not used for a long time.