mirror of
https://github.com/CloakHQ/CloakBrowser.git
synced 2026-06-23 11:41:46 +02:00
fix(docker): clean up stale Xvfb lock so container survives restarts (#284)
On `docker restart`, `/tmp` is preserved across container instances, so the previous Xvfb's `/tmp/.X99-lock` survives into the new container. The new Xvfb sees the existing lock and refuses to start, leaving the container with no X server. Every Chrome launch then dies with "Missing X server or $DISPLAY", and `cloakserve` returns 502 from `/json/version` forever. Any orchestrator that restarts on unhealthy (the README-recommended healthcheck + `restart: always`, autoheal sidecars, etc.) then enters a permanent restart loop because every restart hits the same broken state. This is silent for first-time users: the container appears to start successfully (Xvfb did launch *once*), then degrades only after the first restart. The fix is one line in the entrypoint: remove the stale lock before starting Xvfb. Fixes #283
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Clean up any stale Xvfb lock left behind by a previous container instance.
|
||||
# `/tmp` is not a tmpfs in this image, so on `docker restart` the previous
|
||||
# container's `/tmp/.X99-lock` survives, and Xvfb refuses to start with an
|
||||
# existing lock — leaving the container with no X server, every Chrome
|
||||
# launch dying with "Missing X server or $DISPLAY", and `cloakserve`
|
||||
# returning 502 forever. See CloakHQ/CloakBrowser#283.
|
||||
rm -f /tmp/.X99-lock /tmp/.X11-unix/X99
|
||||
|
||||
# Start Xvfb for headed mode (Turnstile, CAPTCHAs), then run user command
|
||||
Xvfb :99 -screen 0 1920x1080x24 -nolisten tcp &
|
||||
sleep 1
|
||||
|
||||
Reference in New Issue
Block a user