vnc | Use vnc with live-server | selenium vnc server | Search

This Dockerfile configures a container to run a VNC server with a customized resolution, scaling, and user account.

Run example

npm run import -- "VNC in Docker"

VNC in Docker


RUN dos2unix /home/seluser/novnc/utils/launch.sh
RUN sed -i -e 's/export GEOMETRY.*/export GEOMETRY="8160x6120x24"/g' /opt/bin/start-xvfb.sh
RUN sed -i -e 's/x11vnc/x11vnc -scale 4080x3060 -noxdamage/g' /opt/bin/start-vnc.sh
RUN sed -i '/wait \$/i/home/seluser/novnc/utils/launch.sh --vnc localhost:5900 &' /opt/bin/entry_point.sh
USER seluser

What the code could have been:

bash
#!/bin/bash

# Remove Windows line endings from launch.sh using dos2unix
RUN dos2unix /home/seluser/novnc/utils/launch.sh

# Refactor start-xvfb.sh to update geometry
sed -i -e's/export GEOMETRY.*/export GEOMETRY="8160x6120x24"/g' /opt/bin/start-xvfb.sh

# Refactor start-vnc.sh to update scale and disable xdamage
sed -i -e's/x11vnc/x11vnc -scale 4080x3060 -noxdamage/g' /opt/bin/start-vnc.sh

# Refactor entry_point.sh to wait for launch.sh to finish
sed -i '/wait \$/i/home/seluser/novnc/utils/launch.sh --vnc localhost:5900 &' /opt/bin/entry_point.sh

# Set current user to seluser
USER seluser

This code snippet appears to be part of a Dockerfile, used to configure a Docker image for running a VNC server with a specific resolution and some customizations.

Here's a breakdown:

  1. RUN dos2unix /home/seluser/novnc/utils/launch.sh:

  2. RUN sed -i -e 's/export GEOMETRY.*/export GEOMETRY="8160x6120x24"/g' /opt/bin/start-xvfb.sh:

  3. RUN sed -i -e 's/x11vnc/x11vnc -scale 4080x3060 -noxdamage/g' /opt/bin/start-vnc.sh:

  4. RUN sed -i '/wait \$/i/home/seluser/novnc/utils/launch.sh --vnc localhost:5900 &' /opt/bin/entry_point.sh:

  5. USER seluser:

In essence, this Dockerfile configures a container to run a VNC server with a specific resolution, scales the display, and sets up a user account for accessing the server.