feat: add ubuntu-vnc

This commit is contained in:
DCsunset 2020-02-01 21:20:10 -08:00
parent 351a70e8e5
commit 94cff507b7
5 changed files with 108 additions and 0 deletions

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
ARG VERSION
FROM ubuntu:${VERSION:-latest}
LABEL MAINTAINER="DCsunset"
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq xfce4 xfce4-goodies \
tigervnc-standalone-server \
chromium-browser vim
COPY ./config/helpers.rc /root/.config/xfce4/
COPY ./config/chromium-WebBrowser.desktop /root/.local/share/xfce4/helpers/
COPY ./start.sh /
EXPOSE 5900 80
CMD [ "/start.sh" ]

65
README.md Normal file
View file

@ -0,0 +1,65 @@
# docker-ubuntu-vnc
An Ubuntu docker image to provide VNC access to
Xfce desktop environment.
## Usage
```
docker run -d -p 5900:5900 -e VNC_PASSWD=password dcsunset/ubuntu-vnc
```
If `VNC_PASSWD` is not set,
then the security type of vncserver is set to None,
it is **insecure** when exposing the container on the Internet.
## Exposed ports
* 5900: Used for VNC interface
## Installed applications
To make the image lightweight,
only the following applications are installed by default:
* Xfce desktop
* TigerVNC server
* Vim
* Chromium browser
## Fonts
If non-latin characters are not displayed well,
install the font packs based on your needs.
To install the Indian font pack:
```
sudo apt-get install fonts-indic
```
To install the CJK font pack:
```
sudo apt-get install fonts-noto-cjk
```
To install the international font pack:
```
sudo apt-get install fonts-noto
```
## Build
To use the latest Ubuntu image:
```
docker build -t ubuntu-vnc .
```
Or specify a version:
```
docker build --build-arg VERSION=18.04 -t ubuntu-vnc .
```

View file

@ -0,0 +1,10 @@
[Desktop Entry]
NoDisplay=true
Version=1.0
Encoding=UTF-8
Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-CommandsWithParameter=chromium-browser --no-sandbox "%s"
Icon=chromium-browser
Name=chromium-browser
X-XFCE-Commands=chromium-browser --no-sandbox

2
config/helpers.rc Normal file
View file

@ -0,0 +1,2 @@
TerminalEmulator=xfce4-terminal
WebBrowser=chromium-WebBrowser

14
start.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
umask 0077 # use safe default permissions
mkdir -p "$HOME/.vnc" # create config directory
chmod go-rwx "$HOME/.vnc" # enforce safe permissions
if [ ! -z $VNC_PASSWD ]; then
vncpasswd -f <<< "$VNC_PASSWD" > "$HOME/.vnc/passwd"
vncserver -fg -localhost no :0
else
vncpasswd -f <<< "" > "$HOME/.vnc/passwd"
vncserver -fg --I-KNOW-THIS-IS-INSECURE -SecurityTypes None -localhost no :0
fi