Docker Community Forums

Share and learn in the Docker community.

"killed" when running Composer commands despite 12gb of ram allocated. Docker toolbox says it can only use 2gb


(Plato1123) #1

I’ve moved to a new computer with Windows 10 and have installed docker toolbox. I’m finding I can’t run most composer commands because I get “killed”. My virtualbox has been allocated an astronomical 12 gb.
When I run free -m I get

                total        used        free      shared  buff/cache   available

Mem: 12090 261 11525 235 302 11402
Swap: 3916 0 3916

However when I run a really simple composer command like
composer require ‘drupal/video_embed_field:^2.0’
It spins for 5 or 10 mins and then says “killed”.

If I open another terminal window and run “docker stats” it shows that 2gb is the maximum memory (wtf?) and the command gets to about 98 or 99% of that and runs for quite some time and then the other window says “killed” and it returns to about 200kb used.

Why can’t docker toolbox use all 12gb? How can any simple composer command take over TWO GIGABYTES?? Unfortunately I left my mac at work so I can’t see if that also is limited to 2gb. Very frustrating, I’m at my wits end, I’ve been trying to run one of several simple composer commands for at least a day and a half and docker toolbox and composer simply will not work together.

edit: Note that “composer install” is one of the commands that seems to consistently work, but composer
remove and composer require commands bork every time. Thanks for your help!

edit2: Windows 10 home 64-bit, 16gb ram, 512gb ssd.


(Plato1123) #2

I see docker on my mac is allowed to use 8gb, not just 2gb like on my PC, what am I doing wrong? I see on my windows computer I have about 3gb of swap space, is there a way I can increase that? I’ve gone through half a dozen articles on increasing swap on ubuntu 16 and none of them work on docker. One land mine after another. Very frustrated.


(Plato1123) #3

Was finally able to increase the memory by recreating the docker container and specifying the gb to use during creation. The swap size didn’t increase with this command but docker stats finally shows 8gb instead of 2gb.
I used

docker run -v ~/documents/mywebsite/shared:/var/www/mydrupalsite/sharedfiles -dit --name myimage6-1-18 --memory-swap -1 --memory 8g -p 0.0.0.0:443:443 -p 0.0.0.0:80:80 3d4a5e253047 /bin/bash


(Eric Smalling) #4

Can you share the docker command you were running originally?


(Plato1123) #5

I think originally I was using the exact same docker run command as above except without the “–memory-swap -1 --memory 8gb” parameters. Thx!!


(Eric Smalling) #6

Interesting. Docker’s default behavior, when you do not specify a --memory c-group limit is to allow the process to have as much memory as the host machine. But your free -m response indicates that’s not the problem here.

I’m no PHP coder but I did find the following issue at Drupal.org, could it be that composer itself is doing the killing based on it’s memory-limit? https://www.drupal.org/project/video_embed_field/issues/2965810