From eb7bc7c045a26c10e88ef47e8e58be505635f264 Mon Sep 17 00:00:00 2001 From: jjbrunton Date: Fri, 22 May 2026 19:01:32 +0100 Subject: [PATCH] Install x11-utils and wait reliably for Xvfb in entrypoint The Xvfb readiness loop in entrypoint.sh used xdpyinfo, which isn't in the Playwright base image. On busy hosts the loop fell through before Xvfb was ready, so Chromium launched with no X server and crashed with "Missing X server or \$DISPLAY". Add x11-utils (provides xdpyinfo) and extend the readiness loop to 10 s with explicit logging. Co-Authored-By: Claude Opus 4.7 --- Dockerfile | 1 + docker/entrypoint.sh | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 06b3689..757d1d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ tzdata \ xvfb \ x11vnc \ + x11-utils \ novnc \ websockify \ fluxbox \ diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index f16a020..bac874c 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -29,10 +29,16 @@ echo "[entrypoint] starting Xvfb on ${DISPLAY} (${GEOMETRY})" Xvfb "${DISPLAY}" -screen 0 "${GEOMETRY}" -ac +extension RANDR & XVFB_PID=$! -# Give Xvfb a moment to come up. -for _ in 1 2 3 4 5 6 7 8 9 10; do - if xdpyinfo -display "${DISPLAY}" >/dev/null 2>&1; then break; fi +# Give Xvfb a moment to come up. Requires x11-utils (xdpyinfo). +for i in $(seq 1 50); do + if xdpyinfo -display "${DISPLAY}" >/dev/null 2>&1; then + echo "[entrypoint] Xvfb is ready after ${i} checks" + break + fi sleep 0.2 + if [ "${i}" = "50" ]; then + echo "[entrypoint] WARNING: Xvfb did not respond after 10s" >&2 + fi done # Minimal window manager so dialogs and tabs aren't stuck behind the root window.