Create more than one VNC server on the same host in Docker

Viewed 14

I would like to create a VNC server in two Docker containers, calling them ContainerA & ContainerB. ContainerA and ContainerB must both be exposed to the host network via --network="host". When I try to instantiate two VNC servers it fails to be created because the address space is already being used, address being alfred. Even after changing the port being used, display offset, etc, nothing seems to work.

If anyone has had any experience in this that would be great. A solution that I'll shoot down right now is bridging the containers where they each have their own unique address space via bridge. As how the system is configured this cannot happen.

Thanks!

My Current Setup

The setup is that I am now trying a intermediate VNC container and two Firefox containers, still in the works. The work for the two VNC servers exist in the two Dockerfiles listed for FirefoxVNC[A,B].

# compose.yaml
version: '3.7'
services:
    vncserver:
        build: ./VNCServer
        container_name: vncserver
        network_mode: "host"
    firefoxa:
        build: ./FirefoxVNCA
        container_name: firefoxvnca
        network_mode: "host"
    firefoxb:
        build: ./FirefoxVNCB
        container_name: firefoxvncb
        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

EXPOSE 5900
#RUN echo "exec firefox" > ~/.xinitrc && chmod +x ~/.xinitrc
#CMD ["x11vnc", "-create", "-forever", "-rfbport", "5901"]
CMD ["/bin/bash", "-c", "-l", "firefox"]

# FirefoxVNCB/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

EXPOSE 5900
#RUN echo "exec firefox" > ~/.xinitrc && chmod +x ~/.xinitrc
#CMD ["x11vnc", "-create", "-forever", "-rfbport", "5901"]
CMD ["/bin/bash", "-c", "-l", "firefox"]

0 Answers
Related