Docker Alpine Xvfb
howto
This is a simple guide to get Alpine working with xvfb. It will work in a container or on a plain Alpine Linux install (VM or otherwise).
Install Required Components
Be sure to be using Alpine 3.8 (or maybe above) as the x11vnc
package is
not present in 3.7 repositories (main and community).
apk add xvfb fluxbox tmux x11vnc st
Update some Configuration Files
By default fluxbox menu starts xterm... we no have xterm.
sed -r -i 's/\[exec\] \(xterm\) \{xterm\}/\[exec\] \(st\) \{st\}/' /usr/share/fluxbox/menu
Start fluxbox from xinit.
echo "exec fluxbox" > ~/.xinitrc
Run X in Virtual Frame Buffer Mode
These commands will have to be run in separate terminals... why do you think
I installed tmux
?
xinit -- /usr/bin/Xvfb :1 -screen 0 1024x768x24
x11vnc -nopw -rfbport 5901 -permitfiletransfer -display :1
Connecting to the server is simple (provided the port is allowed through the firewall/iptables):
vncviewer 172.17.0.2:1
No password is setup (the -nopw
argument). The x11vnc
server will
terminate when the vncviewer disconnects (the programmes will still run
but the ability to connect via VNC will not work until the second commmand
is run again on that server). To avoid this rather annoying feature simply
add the -forever switch to the x11vnc command, like this:
x11vnc -forever -nopw -rfbport 5901 -permitfiletransfer -display :1
For more detail and a little script, please see my repository on github.