This repository contains the necessary files to build a Docker image based on Ubuntu 18.04 with the Xfce4 desktop and TightVNC server installed. Along with this, notable convenience packages include Vim, Tmux, and Firefox.
The simplest way to build an image named ubuntu-vnc
is
docker build -t ubuntu-vnc .
What's above is also how the images on Docker Hub at herter4171/ubuntu-vnc are built.
Additionally, you have the option to bake in your desired VNC password at build-time by specifying the argument VNC_PASS
. For password mypass
, the build command is as follows.
docker build --build-arg VNC_PASS=mypass -t ubuntu-vnc .
The content of VNC_PASS
is used to invoke vncpasswd
using expect at build-time to establish a fully configured image that can safely launch in a detached state.
The main bit of nuance to using the image is that port 5901 must be open. If the VNC password was not set at build-time, you'll want to run
docker run -ti -p 5901:5901 ubuntu-vnc
After hitting enter, you will be prompted to enter a VNC password, and the server will run until you exit out of the shell.
If you did specify a VNC password using the build argument VNC_PASS
, you can safely launch your container in a detached state like so.
docker run -d -ti -p 5901:5901 ubuntu-vnc
The built image is designed to be run for the non-root user dev
. If you have reason to worry about attacks between your VNC client and the server, an SSH tunneling scheme of some kind is the standard way to lock things down.