I would like to run firefox (or any graphical application) inside docker container.
My requirement: When I start the container, I should be creatin
I'm using the following Bash function:
# Configure virtual display and wine.
# Usage: set_display
set_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?