Not sure if this is specific to Ghost (possibly not) and I need to look into this more but I had an annoying issue recently while trying to do some memory restrictions on Docker for Ghost.

The blog would sometimes start but often fail during migration/upgrade or randomly when the admin interface was accessed. I'd recently made a change to introduce memory restrictions (to properly define boundaries for garbage collection) onto the OS. I was re-creating the docker containers (256Mb for the important blog and 128Mb for this one).

This worked fine for other containers but when I tried to spin up my blog I got this (or something similar):

npm info it worked if it ends with ok
npm info using npm@2.15.9
npm info using node@v4.5.0
npm info prestart ghost@0.10.1
npm info start ghost@0.10.1

> ghost@0.10.1 start /usr/src/ghost
> node index


npm info ghost@0.10.1 Failed to exec start script
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.5.0
npm ERR! npm  v2.15.9
npm ERR! ghost@0.10.1 start: `node index`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the ghost@0.10.1 start script 'node index'.
npm ERR! This is most likely a problem with the ghost package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ghost
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls ghost
npm ERR! There is likely additional logging output above.
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.5.0
npm ERR! npm  v2.15.9
npm ERR! path npm-debug.log.896050243
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open

npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.896050243'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, open 'npm-debug.log.896050243']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path: 'npm-debug.log.896050243' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/ghost/npm-debug.log

After much stuffing around I discovered the really important part of this log is the Killed line.

npm install ran out of memory and was unable to complete. You’ll need to increase the virtual memory available to npm.


So at least for now it seems I can't get the official Ghost docker container to run with less than 256Mb memory. I might follow up on this and try to find out why but I thought I'd post it on here in case anyone else has a similar issue.