对于某些站点,无头 Chromium 在 Docker 容器中运行时会失败:
[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
Run Code Online (Sandbox Code Playgroud)
我应该如何调整 Docker 来解决这个问题?
Jar*_*ard 24
如第 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)
Run Code Online (Sandbox Code Playgroud)
这是由/dev/shmDocker 中设置为 64mb 的默认值来处理的,这对于现代 Web 应用程序来说并不多。
有关上下文,/dev/shm请参见此处https://superuser.com/questions/45342/when-should-i-use-dev-shm-and-when-should-i-use-tmp
运行 chrome --disable-dev-shm-usage
将/dev/shm大小设置为合理的数量,docker run -it --shm-size=1g替换1g为您想要的任何数量。
| 归档时间: |
|
| 查看次数: |
5131 次 |
| 最近记录: |