Using VNCserver + GUI application + Virtual Display in Docker container Using VNCserver + GUI application + Virtual Display in Docker container docker docker

Using VNCserver + GUI application + Virtual Display in Docker container


I managed to found the solution:

Changed the script in Attempt 3 above as follows worked

!/bin/bashXvfb :1 -screen 0 800x600x16 &/usr/bin/x11vnc -display :1.0 -usepw &DISPLAY=:1.0export DISPLAYfirefox

Cheers.


I'm using the following Bash function:

# Configure virtual display and wine.# Usage: set_displayset_display() {  export DISPLAY=${DISPLAY:-:0} # Select screen 0 by default.  xdpyinfo &>/dev/null && return  if command -v x11vnc &>/dev/null; then    ! pgrep -a x11vnc && x11vnc -bg -forever -nopw -quiet -display WAIT$DISPLAY &  fi  ! pgrep -a Xvfb && Xvfb $DISPLAY -screen 0 1024x768x16 &  sleep 1  if command -v fluxbox &>/dev/null; then    ! pgrep -a fluxbox && fluxbox 2>/dev/null &  fi  echo "IP: $(hostname -I) ($(hostname))"}

Then source the file and call set_display. Consider configuring the password via -usepw.

I'm using it in the following Docker project (check .funcs.cmds.inc.sh).

Check also: How to make Xvfb display visible?