Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Headless Chromium on Docker fails

With some sites headless Chromium is failing when it is running inside Docker container:

[0520/093103.024239:ERROR:platform_shared_memory_region_posix.cc(268)] Failed to reserve 16728064 bytes for shared memory.: No space left on device (28)
[0520/093103.024591:ERROR:validation_errors.cc(76)] Invalid message: VALIDATION_ERROR_UNEXPECTED_NULL_POINTER (null field 1)
[0520/093103.024946:FATAL:memory.cc(22)] Out of memory. size=16723968

How should I tune Docker to fix this?

like image 441
Jonas Avatar asked May 20 '19 09:05

Jonas


1 Answers

You're running out of shared memory as is described in line 1.

[0520/093103.024239:ERROR:platform_shared_memory_region_posix.cc(268)] Failed to reserve 16728064 bytes for shared memory.: No space left on device (28)

This is handled by /dev/shm which is set to a default of 64mb in Docker, which isn't that much for modern web applications.

For context on /dev/shm see here https://superuser.com/questions/45342/when-should-i-use-dev-shm-and-when-should-i-use-tmp

Option 1:

Run chrome with --disable-dev-shm-usage

Option 2:

Set /dev/shm size to a reasonable amount docker run -it --shm-size=1g replacing 1g with whatever amount you want.

like image 147
Jared Allard Avatar answered Sep 28 '22 00:09

Jared Allard