So. I've build myself a custom Selenium-Chrome-Node Docker image, which's purpose is to host a node, a virtual display and also a x11vnc Server to connect to the display.
My docker image has enviroment variables to it, so I can easily create two containers with two seperate virtual display to have a backup node, when running selenium tests.
The Selenium side is working fine, but when I start the xvfb virtual display, they both end up on the same display. e.g. :91
Here is what I run + the output it gives, which would indicate they are two seperate display. Its one docker-compose file, so I will sort the code per node for easier readability. In line 9 and 10 you can see what commands are run.
Node 1
snode_postgres_1 | Node IP: 192.168.56.103
snode_postgres_1 | Node Port: 5555
snode_postgres_1 | NODE Application Name: dsnjen_postgres
snode_postgres_1 | Hub IP: 192.168.56.104
snode_postgres_1 | Hub Port: 4444
snode_postgres_1 | Display Number: :90
snode_postgres_1 | x11vnc Port: 5900
snode_postgres_1 | Now running:
snode_postgres_1 | Xvfb :90 -screen 0 1920x1080x24 -nolisten tcp
snode_postgres_1 | x11vnc -create -env X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 -env debug=1 -display :90 -env X11VNC_CREATE_GEOM=./startnode.sh -gone killall Xvfb -nopw -rfbport 5900 -forever -shared
snode_postgres_1 | 21/06/2022 07:56:20 passing arg to libvncserver: -rfbport
snode_postgres_1 | 21/06/2022 07:56:20 passing arg to libvncserver: 5900
snode_postgres_1 | 21/06/2022 07:56:20 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 12
snode_postgres_1 | 21/06/2022 07:56:20 Using X display :90
snode_postgres_1 | 21/06/2022 07:56:20 rootwin: 0x50e reswin: 0x200001 dpy: 0x54c79400
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 ------------------ USEFUL INFORMATION ------------------
snode_postgres_1 | 21/06/2022 07:56:20 X DAMAGE available on display, using it for polling hints.
snode_postgres_1 | 21/06/2022 07:56:20 To disable this behavior use: '-noxdamage'
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Most compositing window managers like 'compiz' or 'beryl'
snode_postgres_1 | 21/06/2022 07:56:20 cause X DAMAGE to fail, and so you may not see any screen
snode_postgres_1 | 21/06/2022 07:56:20 updates via VNC. Either disable 'compiz' (recommended) or
snode_postgres_1 | 21/06/2022 07:56:20 supply the x11vnc '-noxdamage' command line option.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Wireframing: -wireframe mode is in effect for window moves.
snode_postgres_1 | 21/06/2022 07:56:20 If this yields undesired behavior (poor response, painting
snode_postgres_1 | 21/06/2022 07:56:20 errors, etc) it may be disabled:
snode_postgres_1 | 21/06/2022 07:56:20 - use '-nowf' to disable wireframing completely.
snode_postgres_1 | 21/06/2022 07:56:20 - use '-nowcr' to disable the Copy Rectangle after the
snode_postgres_1 | 21/06/2022 07:56:20 moved window is released in the new position.
snode_postgres_1 | 21/06/2022 07:56:20 Also see the -help entry for tuning parameters.
snode_postgres_1 | 21/06/2022 07:56:20 You can press 3 Alt_L's (Left "Alt" key) in a row to
snode_postgres_1 | 21/06/2022 07:56:20 repaint the screen, also see the -fixscreen option for
snode_postgres_1 | 21/06/2022 07:56:20 periodic repaints.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 XFIXES available on display, resetting cursor mode
snode_postgres_1 | 21/06/2022 07:56:20 to: '-cursor most'.
snode_postgres_1 | 21/06/2022 07:56:20 to disable this behavior use: '-cursor arrow'
snode_postgres_1 | 21/06/2022 07:56:20 or '-noxfixes'.
snode_postgres_1 | 21/06/2022 07:56:20 using XFIXES for cursor drawing.
snode_postgres_1 | 21/06/2022 07:56:20 GrabServer control via XTEST.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Scroll Detection: -scrollcopyrect mode is in effect to
snode_postgres_1 | 21/06/2022 07:56:20 use RECORD extension to try to detect scrolling windows
snode_postgres_1 | 21/06/2022 07:56:20 (induced by either user keystroke or mouse input).
snode_postgres_1 | 21/06/2022 07:56:20 If this yields undesired behavior (poor response, painting
snode_postgres_1 | 21/06/2022 07:56:20 errors, etc) it may be disabled via: '-noscr'
snode_postgres_1 | 21/06/2022 07:56:20 Also see the -help entry for tuning parameters.
snode_postgres_1 | 21/06/2022 07:56:20 You can press 3 Alt_L's (Left "Alt" key) in a row to
snode_postgres_1 | 21/06/2022 07:56:20 repaint the screen, also see the -fixscreen option for
snode_postgres_1 | 21/06/2022 07:56:20 periodic repaints.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 XKEYBOARD: number of keysyms per keycode 7 is greater
snode_postgres_1 | 21/06/2022 07:56:20 than 4 and 51 keysyms are mapped above 4.
snode_postgres_1 | 21/06/2022 07:56:20 Automatically switching to -xkb mode.
snode_postgres_1 | 21/06/2022 07:56:20 If this makes the key mapping worse you can
snode_postgres_1 | 21/06/2022 07:56:20 disable it with the "-noxkb" option.
snode_postgres_1 | 21/06/2022 07:56:20 Also, remember "-remap DEAD" for accenting characters.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 X FBPM extension not supported.
snode_postgres_1 | Xlib: extension "DPMS" missing on display ":90".
snode_postgres_1 | 21/06/2022 07:56:20 X display is not capable of DPMS.
snode_postgres_1 | 21/06/2022 07:56:20 --------------------------------------------------------
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Default visual ID: 0x21
snode_postgres_1 | 21/06/2022 07:56:20 Read initial data from X display into framebuffer.
snode_postgres_1 | 21/06/2022 07:56:20 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/7680
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 X display :90 is 32bpp depth=24 true color
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Listening for VNC connections on TCP port 5900
snode_postgres_1 | 21/06/2022 07:56:20 rfbListenOnTCP6Port: error in bind IPv6 socket: Address already in use
snode_postgres_1 | 21/06/2022 07:56:20 listen6: bind: Address already in use
snode_postgres_1 | 21/06/2022 07:56:20 Not listening on IPv6 interface.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 Xinerama is present and active (e.g. multi-head).
snode_postgres_1 | 21/06/2022 07:56:20 Xinerama: number of sub-screens: 1
snode_postgres_1 | 21/06/2022 07:56:20 Xinerama: no blackouts needed (only one sub-screen)
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 | 21/06/2022 07:56:20 fb read rate: 2475 MB/sec
snode_postgres_1 | 21/06/2022 07:56:20 fast read: reset -wait ms to: 10
snode_postgres_1 | 21/06/2022 07:56:20 fast read: reset -defer ms to: 10
snode_postgres_1 | 21/06/2022 07:56:20 The X server says there are 10 mouse buttons.
snode_postgres_1 | 21/06/2022 07:56:20 screen setup finished.
snode_postgres_1 | 21/06/2022 07:56:20
snode_postgres_1 |
snode_postgres_1 | The VNC desktop is: lcmadmin-virtualbox:0
snode_postgres_1 | PORT=5900
snode_postgres_1 |
snode_postgres_1 | ******************************************************************************
snode_postgres_1 | Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?
snode_postgres_1 |
snode_postgres_1 | The scheme stores pixel data offscreen on the VNC viewer side for faster
snode_postgres_1 | retrieval. It should work with any VNC viewer. Try it by running:
snode_postgres_1 |
snode_postgres_1 | x11vnc -ncache 10 ...
snode_postgres_1 |
snode_postgres_1 | One can also add -ncache_cr for smooth 'copyrect' window motion.
snode_postgres_1 | More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
Node 2
snode_postgres_2 | Node IP: 192.168.56.103
snode_postgres_2 | Node Port: 5556
snode_postgres_2 | NODE Application Name: dsnjen_postgres
snode_postgres_2 | Hub IP: 192.168.56.104
snode_postgres_2 | Hub Port: 4444
snode_postgres_2 | Display Number: :91
snode_postgres_2 | x11vnc Port: 5901
snode_postgres_2 | Now running:
snode_postgres_2 | Xvfb :91 -screen 0 1920x1080x24 -nolisten tcp
snode_postgres_2 | x11vnc -create -env X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 -env debug=1 -display :91 -env X11VNC_CREATE_GEOM=./startnode.sh -gone killall Xvfb -nopw -rfbport 5901 -forever -shared
snode_postgres_2 | 21/06/2022 07:56:20 passing arg to libvncserver: -rfbport
snode_postgres_2 | 21/06/2022 07:56:20 passing arg to libvncserver: 5901
snode_postgres_2 | 21/06/2022 07:56:20 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 12
snode_postgres_2 | 21/06/2022 07:56:20 Using X display :91
snode_postgres_2 | 21/06/2022 07:56:20 rootwin: 0x50e reswin: 0x200001 dpy: 0x6c60b400
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 ------------------ USEFUL INFORMATION ------------------
snode_postgres_2 | 21/06/2022 07:56:20 X DAMAGE available on display, using it for polling hints.
snode_postgres_2 | 21/06/2022 07:56:20 To disable this behavior use: '-noxdamage'
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Most compositing window managers like 'compiz' or 'beryl'
snode_postgres_2 | 21/06/2022 07:56:20 cause X DAMAGE to fail, and so you may not see any screen
snode_postgres_2 | 21/06/2022 07:56:20 updates via VNC. Either disable 'compiz' (recommended) or
snode_postgres_2 | 21/06/2022 07:56:20 supply the x11vnc '-noxdamage' command line option.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Wireframing: -wireframe mode is in effect for window moves.
snode_postgres_2 | 21/06/2022 07:56:20 If this yields undesired behavior (poor response, painting
snode_postgres_2 | 21/06/2022 07:56:20 errors, etc) it may be disabled:
snode_postgres_2 | 21/06/2022 07:56:20 - use '-nowf' to disable wireframing completely.
snode_postgres_2 | 21/06/2022 07:56:20 - use '-nowcr' to disable the Copy Rectangle after the
snode_postgres_2 | 21/06/2022 07:56:20 moved window is released in the new position.
snode_postgres_2 | 21/06/2022 07:56:20 Also see the -help entry for tuning parameters.
snode_postgres_2 | 21/06/2022 07:56:20 You can press 3 Alt_L's (Left "Alt" key) in a row to
snode_postgres_2 | 21/06/2022 07:56:20 repaint the screen, also see the -fixscreen option for
snode_postgres_2 | 21/06/2022 07:56:20 periodic repaints.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 XFIXES available on display, resetting cursor mode
snode_postgres_2 | 21/06/2022 07:56:20 to: '-cursor most'.
snode_postgres_2 | 21/06/2022 07:56:20 to disable this behavior use: '-cursor arrow'
snode_postgres_2 | 21/06/2022 07:56:20 or '-noxfixes'.
snode_postgres_2 | 21/06/2022 07:56:20 using XFIXES for cursor drawing.
snode_postgres_2 | 21/06/2022 07:56:20 GrabServer control via XTEST.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Scroll Detection: -scrollcopyrect mode is in effect to
snode_postgres_2 | 21/06/2022 07:56:20 use RECORD extension to try to detect scrolling windows
snode_postgres_2 | 21/06/2022 07:56:20 (induced by either user keystroke or mouse input).
snode_postgres_2 | 21/06/2022 07:56:20 If this yields undesired behavior (poor response, painting
snode_postgres_2 | 21/06/2022 07:56:20 errors, etc) it may be disabled via: '-noscr'
snode_postgres_2 | 21/06/2022 07:56:20 Also see the -help entry for tuning parameters.
snode_postgres_2 | 21/06/2022 07:56:20 You can press 3 Alt_L's (Left "Alt" key) in a row to
snode_postgres_2 | 21/06/2022 07:56:20 repaint the screen, also see the -fixscreen option for
snode_postgres_2 | 21/06/2022 07:56:20 periodic repaints.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 XKEYBOARD: number of keysyms per keycode 7 is greater
snode_postgres_2 | 21/06/2022 07:56:20 than 4 and 51 keysyms are mapped above 4.
snode_postgres_2 | 21/06/2022 07:56:20 Automatically switching to -xkb mode.
snode_postgres_2 | 21/06/2022 07:56:20 If this makes the key mapping worse you can
snode_postgres_2 | 21/06/2022 07:56:20 disable it with the "-noxkb" option.
snode_postgres_2 | 21/06/2022 07:56:20 Also, remember "-remap DEAD" for accenting characters.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 X FBPM extension not supported.
snode_postgres_2 | Xlib: extension "DPMS" missing on display ":91".
snode_postgres_2 | 21/06/2022 07:56:20 X display is not capable of DPMS.
snode_postgres_2 | 21/06/2022 07:56:20 --------------------------------------------------------
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Default visual ID: 0x21
snode_postgres_2 | 21/06/2022 07:56:20 Read initial data from X display into framebuffer.
snode_postgres_2 | 21/06/2022 07:56:20 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/7680
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 X display :91 is 32bpp depth=24 true color
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Listening for VNC connections on TCP port 5901
snode_postgres_2 | 21/06/2022 07:56:20 Listening for VNC connections on TCP6 port 5900
snode_postgres_2 | 21/06/2022 07:56:20 Listening also on IPv6 port 5901 (socket 10)
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 Xinerama is present and active (e.g. multi-head).
snode_postgres_2 | 21/06/2022 07:56:20 Xinerama: number of sub-screens: 1
snode_postgres_2 | 21/06/2022 07:56:20 Xinerama: no blackouts needed (only one sub-screen)
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 | 21/06/2022 07:56:20 fb read rate: 2485 MB/sec
snode_postgres_2 | 21/06/2022 07:56:20 fast read: reset -wait ms to: 10
snode_postgres_2 | 21/06/2022 07:56:20 fast read: reset -defer ms to: 10
snode_postgres_2 | 21/06/2022 07:56:20 The X server says there are 10 mouse buttons.
snode_postgres_2 | 21/06/2022 07:56:20 screen setup finished.
snode_postgres_2 | 21/06/2022 07:56:20
snode_postgres_2 |
snode_postgres_2 | The VNC desktop is: lcmadmin-virtualbox:1
snode_postgres_2 | PORT=5901
snode_postgres_2 |
snode_postgres_2 | ******************************************************************************
snode_postgres_2 | Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?
snode_postgres_2 |
snode_postgres_2 | The scheme stores pixel data offscreen on the VNC viewer side for faster
snode_postgres_2 | retrieval. It should work with any VNC viewer. Try it by running:
snode_postgres_2 |
snode_postgres_2 | x11vnc -ncache 10 ...
snode_postgres_2 |
snode_postgres_2 | One can also add -ncache_cr for smooth 'copyrect' window motion.
snode_postgres_2 | More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
snode_postgres_2 |
In the logs I found both entries, which tell me, the correct displays are used:
snode_postgres_1 | 21/06/2022 07:56:20 Using X display :90
snode_postgres_2 | 21/06/2022 07:56:20 Using X display :91
But when I connect to the displays via Vinagre, they both share the same display-number and also show the same content. I cant seem to find the error, as the logs also show the correct displays are used.
How can I fix this so that two virtual displays are used..?
EDIT So I split the docker-compose file into two different files and now it seems to work. Can anyone explain to me please, why this is happening?
Here is my docker-compose file:
# docker-compose.yml
version: "3.7"
services:
selenium_1:
image: selenium_c:latest
network_mode: host
container_name: snode_postgres_1
stdin_open: true
privileged: true
tty: true
restart: always
expose:
- 5555
- 5900
ports:
- 5555:5555
- 5900:5900
environment:
- NODE_IP=192.168.56.103
- NODE_PORT=5555
- NODE_APP_NAME=dsnjen_postgres
- HUB_IP=192.168.56.104
- HUB_PORT=4444
- XVBF_DISPLAY_NUMBER=:90
- DISPLAY=:90
- X11VNC_PORT=5900
volumes:
- /dev/shm:/dev/shm
selenium_2:
image: selenium_c:latest
network_mode: host
container_name: snode_postgres_2
stdin_open: true
privileged: true
tty: true
restart: always
expose:
- 5556
- 5901
ports:
- 5556:5556
- 5901:5901
environment:
- NODE_IP=192.168.56.103
- NODE_PORT=5556
- NODE_APP_NAME=dsnjen_postgres
- HUB_IP=192.168.56.104
- HUB_PORT=4444
- XVBF_DISPLAY_NUMBER=:91
- DISPLAY=:91
- X11VNC_PORT=5901
volumes:
- /dev/shm:/dev/shm