[Laravel] How to deal with out of memory error when composer require [Docker]

Overview

The title error occurred when installing composer in Docker environment. I tried several methods with Gugu, but it took some time to solve it, so I will leave it as a reminder.

environment

Docker:19.03.8 Laravel:6.19.1

error contents

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

This is an error that cannot be installed due to insufficient memory.

Solutions

  1. Do the following to enter the app container
make app
//Or
docker-compose exec app bash
  1. Install below
php -d memory_limit=-1 /usr/bin/composer require fruitcake/laravel-cors

**-d ** is an abbreviation for define, and it seems that you can explicitly set the setting value that can be specified in php.ini. PHP Command Line Options

This option allows you to set custom values for configuration directives that you can specify in php.ini. The syntax is as follows: -d configuration_directive[=value]

By setting ** -d memory_limit = -1 **, you can execute unlimited memory limit.

Recommended Posts

[Laravel] How to deal with out of memory error when composer require [Docker]
[Docker environment] How to deal with ActiveSupport :: MessageEncryptor :: InvalidMessage
How to make Laravel faster with Docker for Mac
[Docker + Rails] How to deal with Rails server startup failure
[Docker] How to update using a container on Heroku and how to deal with Migrate Error
How to deal with the error ERROR: While executing gem ... (Gem :: FilePermissionError)
How to deal with different versions of rbenv and Ruby
General error: 1812 occurs with docker + laravel
How to start Camunda with Docker
[Rails / RSpec] How to deal with element has zero size error
How to deal with 405 Method Not Allowed error in Tomcat + JSP
How to share files with Docker Toolbox
[Android] How to deal with dark themes
How to put out the error bundling
[Rails] How to use rails console with docker
How to execute with commands of normal development language in Docker development environment
How to deal with Precompiling assets failed.
How to run Blazor (C #) with Docker
How to build Rails 6 environment with Docker
When registering a new user, I got an error called ActiveRecord :: NotNullViolation and how to deal with it.
[Ruby] Meaning of &. How to avoid the error when the receiver (object) is nil
[Error resolution] Occurs when trying to build an environment for spring with docker
How to build an environment of [TypeScript + Vue + Express + MySQL] with Docker ~ Vue edition ~
How to start with Hyper-V instead of WSL2 on Docker Desktop for Windows
How to use Eclipse on my PC with 32bit and 2GB of memory
How to find the cause of the Ruby error
[Docker for Mac] Deal with Credentials store error
How to give your image to someone with docker
How to use docker compose with NVIDIA Jetson
How to get resource files out with spring-boot
How to use nginx-ingress-controller with Docker for Mac
[Rails] How to build an environment with Docker
How to deal with the error yaml.scanner.ScannerError: while scanning for the next token that appeared in Rails environment construction with Docker
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error
`bind': Address already in use --bind (2) for 127.0.0.1:3000 (Errno :: EADDRINUSE) How to deal with the error
[Ruby] 5 errors that tend to occur when scraping with Selenium and how to deal with them
[Docker] How to see the contents of Volumes. Start a container with root privileges.
How to deal with `Cannot connect to the Docker daemon at unix: /// var/run/docker.sock. Is the docker daemon running?`
How to deal with Selenium :: WebDriver :: Error :: UnknownError that occurs in Dokcer environment etc.
What to do when routing settings do not work after building Docker environment with Laravel
[Rails] How to solve the error "undefined method` visit'" when using Capybara with Rspec
Summary of how to use the proxy set in IE when connecting with Java
Error when starting JUnit with deprecated version of POI
Diet program with preprocessor (how to deal with i-appli size)
How to deal with fatal: remote origin already exists.
How to build docker environment with Gradle for intelliJ
How to deal with No template for interactive request
Error encountered with notes when deploying docker on rails
How to deal with SQLite3 :: BusyException that occurs when uploading a large number of images using ActiveStorage in seeds.rb etc.
Transit to confirmation page when logging out with devise
[Rails] How to deal with URL changes after render
How to delete untagged images in bulk with Docker
When I bcrypt with node + docker, I got an error
How to boot by environment with Spring Boot of Maven
Common problems with WSL and how to deal with them
When trying to insert a specific gem (levenshtein) with Docker, an error occurred without ruby-dev
Let's find out how to receive in Request Body with REST API of Spring Boot
How to install Docker
Install Composer with Docker
How to automatically generate ER diagram when migrating with Rails6
How to set environment variables when using Payjp with Rails