Hey all, posting here first to see if you can help me figure out what's up.
I have a need for a centralized desktop environment. I have a central server at home, running headless debian VMs, which are installed without a desktop environment (when put into production, this VM won't have a physical or logical graphical display). Here's my steps:
- I first installed gnome desktop environment with tasksel. So far so good.
- I set systemctl to boot to text mode and not launch a desktop environment (to save resources when i'm not vnc'ing in). Also, so far so good.
- I installed tigervnc packages from apt
- as a non-root user not added to sudo group:
- ran vncpassword and set the password
- created xstartup in ~/.vnc/ with the following:
#!/bin/sh
# Start Gnome 3 Desktop
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
dbus-launch --exit-with-session gnome-session &
- As the non-root user, I run:
vncserver -depth 24 -geometry 1440x900 -localhost no
Everything works as expected, i can VNC in with the appropriate password to a gui that exits after the vncserver is shutdown. Perfect
Now, the end goal was to create a docker container. This was going to be deployed in an environment where multiple users would need a container for a short time and then close down. I was inspired by
this container but it was built on ubuntu with xfce. I don't want ubuntu or xfce, so i decided to roll my own.
As the base image, I used
https://hub.docker.com/r/jgoerzen/debian-base-minimal, which is exactly what I want. Unlike the debian:buster images, it does run systemd and a number of other traditional unix components. And, It was similar to the container i linked above as the inspiration, just Debian based.
Here is my dockerfile:
```
FROM jgoerzen/debian-base-minimal
COPY scripts/ /opt/scripts/
RUN apt update \
&& DEBIAN_FRONTEND=noninteractive apt install -y \
--no-install-recommends \
apt-utils \
apt-file \
&& DEBIAN_FRONTEND=noninteractive apt install -y \
wget \
git \
runit \
build-essential \
libssl-dev \
x11-xserver-utils \
dbus-x11 \
dos2unix \
python \
python3 \
python3-distutils \
python3-tk \
python3-dbus \
tigervnc-standalone-server \
tigervnc-xorg-extension \
xauth \
tasksel \
dialog \
&& DEBIAN_FRONTEND=noninteractive tasksel install desktop gnome-desktop \
&& useradd -ms /bin/bash vncuser \
&& mkdir -p /home/vncuser/.vnc/ \
&& mv /opt/scripts/xstartup /home/vncuser/.vnc \
&& chown -R vncuser:vncuser /home/vncuser/.vnc/ /opt/scripts/* \
&& chmod 700 /home/vncuser/.vnc/xstartup \
&& chmod 700 /opt/scripts/*
```
At the moment, the entrypoint script just sleeps as a place holder. I start the script with:
docker run -d -p 5901:5901 --stop-signal=SIGRTMIN+3 --tmpfs /run:size=100M --tmpfs /run/lock:size=100M -v /sys/fs/cgroup:/sys/fs/cgroup:ro gdd:latest
After exec'ing into the container, I attempt to reproduce the same setup steps as with my VM:
- su - vncuser (non-root user with no sudo)
- create the xstartup file just as above.
- vncserver -depth 24 -geometry 1440x900 -localhost no
Here is the output:
vncuser@30c00abe898f:~/.vnc$ vncserver -depth 24 -geometry 1440x900 -localhost no
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
/usr/bin/xauth: file /home/vncuser/.Xauthority does not exist
New '30c00abe898f:1 (vncuser)' desktop at :1 on machine 30c00abe898f
Starting applications specified in /home/vncuser/.vnc/xstartup
Log file is /home/vncuser/.vnc/30c00abe898f:1.log
Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /home/vncuser/.vnc/passwd 30c00abe898f:1 to connect to the VNC server.
And finally, here is the log output:
When i VNC in it's just a black screen. According to the logs, I'm getting a lot of "connection refused" "cannot open display" and "file not found" errors before I even try to connect, so something is really wrong.
Can anyone help me figure out what's missing? I would be most grateful, as this image is last piece to the puzzle for the setup I'm trying to provide for some people who really need it.