1

I have tried to run 'composer update' command inside docker container in Aws ec2 instance. But I get this error

  mmap() failed: [12] Cannot allocate memory

  mmap() failed: [12] Cannot allocate memory

  Fatal error: Out of memory (allocated 478179328) (tried to allocate 20996408 bytes) in phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php on line 462

I have tried using "memory_limit = -1" or "memory_limit = 2G" in the php configaration file. I have also tried to run this command "php -d memory_limit=-1 /usr/local/bin/composer update" inside my docker container. But it still shows the same error

1

1 Answer 1

4

Run composer update in your local environment, then commit composer.json and composer.lock to your code repository, pull the changes in your ec2 instance and run composer install.

Commonly, low resource servers don't have enough RAM to run composer update. You're better off doing it in your local environment, and only using composer install on your server.

Sign up to request clarification or add additional context in comments.

2 Comments

I have firstly run "composer update" in my local enviorment and the commit the code to github and then clone the project in Aws ec2 container. Then run "docker-compose up -d" to run the container and the instde the container run "composer update" command
Don't run composer update inside the container. That's your problem, and there's no real point. Run composer install instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.