#!/usr/bin/env bash set -x RFB_PORT=59${DISPLAY_NUM} NOVNC_PORT=80${DISPLAY_NUM} echo Display at ${DISPLAY} with ${SCREEN_W}x${SCREEN_H}x24 # Xvnc doesn't get a chance to clean these up when the container is killed/stopped, # and /tmp persists across `docker restart`, so a stale lock blocks the next start. rm -f /tmp/.X${DISPLAY_NUM}-lock /tmp/.X11-unix/X${DISPLAY_NUM} Xvnc ${DISPLAY} -geometry ${SCREEN_W}x${SCREEN_H} -depth 24 +xinerama -securitytypes none >/var/log/xvfb.log & fluxbox & websockify -D --web=/usr/share/novnc/ --cert=/tmp/novnc.pem --key=/tmp/novnc.key ${NOVNC_PORT} localhost:${RFB_PORT} socat TCP-LISTEN:60${DISPLAY_NUM},fork,bind=0.0.0.0 UNIX-CONNECT:/tmp/.X11-unix/X${DISPLAY_NUM}