From 497d3e9c2d2b3ef153bb55929bdec72dcd154a97 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Fri, 4 Oct 2024 22:29:32 -0700 Subject: [PATCH] fix chrome trying to use novnc in docker when its not available --- Dockerfile | 3 +-- bin/docker_entrypoint.sh | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9ad82168..9742af20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -214,7 +214,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T at-spi2-common fonts-liberation fonts-noto-color-emoji fonts-tlwg-loma-otf fonts-unifont libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libavahi-client3 \ libavahi-common-data libavahi-common3 libcups2 libfontenc1 libice6 libnspr4 libnss3 libsm6 libunwind8 \ libxaw7 libxcomposite1 libxdamage1 libxfont2 \ - libxkbfile1 libxmu6 libxpm4 libxt6 x11-xkb-utils xfonts-encodings \ + libxkbfile1 libxmu6 libxpm4 libxt6 x11-xkb-utils x11-utils xfonts-encodings \ # xfonts-scalable xfonts-utils xserver-common xvfb \ # chrome can run without dbus/upower technically, it complains about missing dbus but should run ok anyway # libxss1 dbus dbus-x11 upower \ @@ -288,7 +288,6 @@ RUN openssl rand -hex 16 > /etc/machine-id ENV IN_DOCKER=True \ SYSTEM_LIB_DIR=/app/lib \ SYSTEM_TMP_DIR=/tmp \ - DISPLAY=novnc:0.0 \ GOOGLE_API_KEY=no \ GOOGLE_DEFAULT_CLIENT_ID=no \ GOOGLE_DEFAULT_CLIENT_SECRET=no \ diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh index 6261550b..cb461916 100755 --- a/bin/docker_entrypoint.sh +++ b/bin/docker_entrypoint.sh @@ -81,6 +81,13 @@ else mkdir -p "$DATA_DIR/logs" fi +# check if novnc x11 $DISPLAY is available +export DISPLAY="${DISPLAY:-"novnc:0.0"}" +if ! xdpyinfo > /dev/null 2>&1; then + # cant connect to x11 display, unset it so that chrome doesn't try to connect to it and hang indefinitely + unset DISPLAY +fi + # force set the ownership of the data dir contents to the archivebox user and group # this is needed because Docker Desktop often does not map user permissions from the host properly chown $PUID:$PGID "$DATA_DIR"