0x000F - Docker-compose X | Xvfb Ubuntu : Lazarus

0x000F - Docker-compose X | Xvfb Ubuntu : Lazarus

Big thanks to Link which FINALLY explains it all:

Basically:

  • X is a GUI manager between the kernel and the user presenting graphical apps.
  • A display is a mouse-monitor-keyboard combination
  • <hostname>:<display>.<monitor>
  • :0 means localhost implied : display 0 : monitor 0
  • :0.1 means localhost:display0:monitor 1  (two-head monitor)
echo DISPLAY

Giving us:

Creating a Virtual Monitor With Xvfb (X Virtual Frame Buffer)

Xvfb :1 -screen 0 1024x768x16
RUN mkdir "$HOME/.vnc" && chmod go-rwx "$HOME/.vnc" ; 

# Configurazione
COPY vncserver        /etc/init.d/vncserver
COPY vncservers.conf  /etc/vncserver/vncservers.conf
COPY startup          /home/realtebo/.vnc/xstartup

RUN \
    /bin/bash -c "echo -e 'password\npassword\nn' | vncpasswd"; echo; \
    sudo chown realtebo:realtebo ~/.vnc/xstartup; \
    sudo chmod +x ~/.vnc/xstartup; \
    touch ~/.Xauthority ;

ENTRYPOINT export USER=realtebo; export DISPLAY=1; vncserver :1 && /bin/bash

Adding a user to the image:

RUN sudo useradd jenkins --shell /bin/bash --create-home \
  && sudo usermod -a -G sudo jenkins \
  && echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
  && echo 'jenkins:secret' | chpasswd
Linux Rocks Every Day