Change VNC Viewer Display using VNC Server

Viewed 14

I have a VNC Server stood up where the rfbport is set to 1. Now I want to have the display used when connecting using VNC Viewer to be set to :40 instead of :20.

How might I achieve this?

For troubleshooting the issue it can be observed that the server is correctly stood up inside my Docker container that is using --network="host", I will not use bridge.

firefoxvnca | 16/09/2022 14:57:31 Listening also on IPv6 port 5901 (socket 5)
firefoxvnca | 16/09/2022 14:57:31 
firefoxvnca | 
firefoxvnca | The VNC desktop is:      alfred:1
firefoxvnca | PORT=5901
firefoxvnca | 16/09/2022 14:59:21 Got connection from client 127.0.0.1
firefoxvnca | 16/09/2022 14:59:21   other clients:
firefoxvnca | 16/09/2022 14:59:21 Normal socket connection
firefoxvnca | 16/09/2022 14:59:21 incr accepted_client=1 for 127.0.0.1:36878  sock=6
firefoxvnca | 16/09/2022 14:59:21 wait_for_client: got client
firefoxvnca | 16/09/2022 14:59:21 Client Protocol Version 3.8
firefoxvnca | 16/09/2022 14:59:21 Protocol version sent 3.8, using 3.8
firefoxvnca | 16/09/2022 14:59:21 client progressed=1 in 0/1 0.000114 s
firefoxvnca | 16/09/2022 14:59:21 client useCopyRect: 127.0.0.1 0
firefoxvnca | 16/09/2022 14:59:21 client_set_net: 127.0.0.1  0.0007
firefoxvnca | 16/09/2022 14:59:21 wait_for_client: running: env X11VNC_SKIP_DISPLAY=''  /bin/sh /tmp/x11vnc-find_display.rOARQB
firefoxvnca | /tmp/x11vnc-find_display.rOARQB: line 172: netstat: command not found
firefoxvnca | 16/09/2022 14:59:21 wait_for_client: find display cmd failed.
firefoxvnca | 16/09/2022 14:59:21 wait_for_client: FINDCREATEDISPLAY cmd: /bin/sh /tmp/x11vnc-find_display.rOARQB Xvfb
firefoxvnca | /tmp/x11vnc-find_display.rOARQB: line 900: which: command not found
firefoxvnca | /tmp/x11vnc-find_display.rOARQB: line 900: which: command not found
firefoxvnca | /tmp/x11vnc-find_display.rOARQB: line 900: which: command not found
firefoxvnca | /tmp/x11vnc-find_display.rOARQB: line 900: which: command not found
firefoxvnca | /tmp/x11vnc-find_display.rOARQB: line 900: which: command not found
firefoxvnca | trying N=20 ...
firefoxvnca | redir_daemon=
firefoxvnca | /usr/bin/Xvfb :20 -screen 0 1280x1024x24 -cc 4 -nolisten tcp -auth /tmp/.xas8413402.Nrbj9R

Observe the last line where /usr/bin/Xvfb :20 is being set, I would like this to be :40. This appears automated and am curious how this is determined when connecting to the server?

compose.yaml

version: '3.7'
services:
#    vncserver:
#        build: ./VNCServer
#        container_name: vncserver
#        network_mode: "host"
    firefoxa:
        build: ./FirefoxVNCA
        container_name: firefoxvnca
#        ports:
#            - "5901:5901" 
        network_mode: "host"

FirefoxVNCA/Dockerfile

FROM nvidia/cuda:11.7.0-devel-centos7

# RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum update -y
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
RUN yum install -y firefox \
                   x11vnc \
                   xorg-x11-server-Xvfb

ADD entrypoint.sh .
ENV DISPLAY :1
RUN echo "exec firefox" > ~/.xinitrc && chmod +x ~/.xinitrc
ENTRYPOINT ["/bin/bash", "entrypoint.sh"]

FirefoxVNCA/entrypoint.sh

#!/bin/bash

export DISPLAY=:1

Xvfb :1 -screen 0 1280x1024x24 &
x11vnc -display :1 -forever -create -rfbport 5901
0 Answers
Related