Docker Community Forums

Share and learn in the Docker community.

I got memory lack error in docker installing laravel plugin

Trying to add new package in laravel 7 under docker I got memory lack error :
# composer require nunomaduro/phpinsights --dev
Using version ^1.14 for nunomaduro/phpinsights
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)

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

Check for more info on how to handle out of memory errors.

But in the console I see a lot of memory allowed:
root@d6001829f99f:/var/www/hostels3_docker_root# free
total used free shared buff/cache available
Mem: 8085252 5778240 1520788 86808 786224 1956736
Swap: 2104476 2026072 78404

In the php info I see :
memory_limit 2048M 128M

In __DOCKER/web/virtualhost.conf I have parameter :
php_value memory_limit 2048M
Configuration File (php.ini) Path /usr/local/etc/php

but trying to open php.ini
with command :
nano /usr/local/etc/php.ini

nothing was found. Seems this file is virtual ?

Also I know that (when using lamp) for console commands php cli must be configured.
I tried to install php7.3-cli in my __DOCKER/web/Dockerfile.yml :

FROM php:7.3-apache

RUN apt-get update && \
    apt-get install -y \
    python \
    libfreetype6-dev \
    libwebp-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    libzip-dev \
    nano \
    mc \
    git-core \
    curl \
    build-essential \
    openssl \
    libssl-dev \
    libgmp-dev \
    libldap2-dev \
    netcat \
    locate \
    # composer \
    && git clone \
    && cd node \
    && git checkout v12.0.0 \
    && ./configure \
     && make \
     && make install

  RUN npm install cross-env

  RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/

 RUN curl -sS | php -- --install-dir=/usr/local/bin --filename=composer

  RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif php7.3-cli \
&& a2enmod rewrite

COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf

But I got error that php7.3-cli is not found.

In which way can I fix memory lack I have ?

In my hosting kubuntu 18 I have 8GiB of memory :
lsb_release -d; uname -r; uname -i Description: Ubuntu 18.04.4 LTS 4.15.0-112-generic x86_64 free
total used free shared buff/cache available
Mem: 8085252 5623840 141952 110116 2319460 2073288
Swap: 2104476 302848 1801628