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 <noreply@anthropic.com>
This commit is contained in:
jjbruntonandClaude Opus 4.7 committed 2026-05-22 19:01:32 +01:00
1 parent 90d81b840f
commit eb7bc7c045
2 files changed
+10 -3

No files matched your search

+1
View File
@@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
tzdata \ tzdata \
xvfb \ xvfb \
x11vnc \ x11vnc \
x11-utils \
novnc \ novnc \
websockify \ websockify \
fluxbox \ fluxbox \
+9 -3
View File
@@ -29,10 +29,16 @@ echo "[entrypoint] starting Xvfb on ${DISPLAY} (${GEOMETRY})"
Xvfb "${DISPLAY}" -screen 0 "${GEOMETRY}" -ac +extension RANDR & Xvfb "${DISPLAY}" -screen 0 "${GEOMETRY}" -ac +extension RANDR &
XVFB_PID=$! XVFB_PID=$!
# Give Xvfb a moment to come up. # Give Xvfb a moment to come up. Requires x11-utils (xdpyinfo).
for _ in 1 2 3 4 5 6 7 8 9 10; do for i in $(seq 1 50); do
if xdpyinfo -display "${DISPLAY}" >/dev/null 2>&1; then break; fi if xdpyinfo -display "${DISPLAY}" >/dev/null 2>&1; then
echo "[entrypoint] Xvfb is ready after ${i} checks"
break
fi
sleep 0.2 sleep 0.2
if [ "${i}" = "50" ]; then
echo "[entrypoint] WARNING: Xvfb did not respond after 10s" >&2
fi
done done
# Minimal window manager so dialogs and tabs aren't stuck behind the root window. # Minimal window manager so dialogs and tabs aren't stuck behind the root window.