From 7c5ae7d6d783a80f63831df900b0b8acaaa08d34 Mon Sep 17 00:00:00 2001 From: Stanislav Pankevich Date: Thu, 27 Feb 2025 20:15:32 +0100 Subject: [PATCH] Enable execution in Docker environments --- html2print/html2print.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/html2print/html2print.py b/html2print/html2print.py index c553613..af6f006 100644 --- a/html2print/html2print.py +++ b/html2print/html2print.py @@ -312,6 +312,14 @@ def create_webdriver(chromedriver: Optional[str], path_to_cache_dir: str): webdriver_options.add_argument("--headless") webdriver_options.add_argument("--disable-extensions") + # The Chrome option --disable-dev-shm-usage disables the use of /dev/shm + # (shared memory) for temporary storage in Chrome. + # By default, Chrome uses /dev/shm for storing temporary files to improve + # performance. However, in environments with limited shared memory (such as + # Docker containers), this can lead to crashes or issues due to insufficient + # space. + webdriver_options.add_argument("--disable-dev-shm-usage") + webdriver_options.add_experimental_option("useAutomationExtension", False) webdriver_options.add_experimental_option( "excludeSwitches", ["enable-automation"]