This Docker image is installed with the following components:
- Desktop environment Xfce4
- VNC-Server (default VNC port
5901
) - noVNC - HTML5 VNC client (default http port
6901
) - Browsers:
- Chromium
docker build --rm -f "Dockerfile.ubuntu.xfce.vnc" -t onepanel/vnc:latest .
-
Print out help page:
docker run onepanel/vnc:latest --help
-
Run command with mapping to local port
5901
(vnc protocol) and6901
(vnc web access):docker run -d -p 5901:5901 -p 6901:6901 onepanel/vnc:latest
-
Change the default user and group within a container to your own with adding
--user $(id -u):$(id -g)
:docker run -d -p 5901:5901 -p 6901:6901 --user $(id -u):$(id -g) onepanel/vnc:latest
-
If you want to get into the container use interactive mode
-it
andbash
docker run -it -p 5901:5901 -p 6901:6901 onepanel/vnc:latest bash
If the container is started like mentioned above, connect via one of these options:
- connect via VNC viewer
localhost:5901
, default password:vncpassword
- connect via noVNC HTML5 full client:
http://localhost:6901/vnc.html
, default password:vncpassword
- connect via noVNC HTML5 lite client:
http://localhost:6901/?password=vncpassword
Example:
## Custom Dockerfile
FROM onepanel/vnc:latest
ENV REFRESHED_AT 2020-06-01
## Install a gedit
RUN yum install -y gedit \
&& yum clean all
You can change the user id as follows:
Add the --user
flag to your docker run command:
docker run -it --user 0 -p 6911:6901 onepanel/vnc:latest
Add the --user
flag to your docker run command:
docker run -it -p 6911:6901 --user $(id -u):$(id -g) onepanel/vnc:latest
The following VNC environment variables can be overwritten at the docker run
phase to customize your desktop environment inside the container:
VNC_COL_DEPTH
, default:24
VNC_RESOLUTION
, default:1280x1024
VNC_PW
, default:my-pw
VNC_PASSWORDLESS
, default:<not set>
Simply overwrite the value of the environment variable VNC_PW
. For example in
the docker run command:
docker run -it -p 5901:5901 -p 6901:6901 -e VNC_PW=my-pw onepanel/vnc:latest
Simply overwrite the value of the environment variable VNC_RESOLUTION
. For example in
the docker run command:
docker run -it -p 5901:5901 -p 6901:6901 -e VNC_RESOLUTION=800x600 onepanel/vnc:latest
Set VNC_PASSWORDLESS
to true
to disable the VNC password.
It is highly recommended that you put some kind of authorization mechanism
before this. For example in the docker run command:
docker run -it -p 5901:5901 -p 6901:6901 -e VNC_PASSWORDLESS=true onepanel/vnc:latest
It's possible to prevent unwanted control via VNC. Therefore you can set the environment variable VNC_VIEW_ONLY=true
. If set, the startup script will create a random password for the control connection and use the value of VNC_PW
for view only connection over the VNC connection.
docker run -it -p 5901:5901 -p 6901:6901 -e VNC_VIEW_ONLY=true onepanel/vnc:latest
If you open some graphic/work intensive websites in the Docker container (especially with high resolutions, e.g. 1920x1080
) Chromium can crash without any specific reason. The problem is that size of /dev/shm
too small in the container. You can define this size on startup via the --shm-size
option:
docker run --shm-size=256m -it -p 6901:6901 -e VNC_RESOLUTION=1920x1080 onepanel/vnc:latest chromium-browser http://map.norsecorp.com/
This repository is a fork of https://github.com/ConSol/docker-headless-vnc-container