Here’s the final all-in-one Dockerfile for your ubuntu-zzh-vnc
container, ready to build and run on Windows. It includes:
-
XFCE desktop (lightweight)
-
zsh + Oh My Zsh with
agnoster
theme -
Common dev tools:
vim
,htop
,python3
,pip
,nodejs
,npm
-
VNC server with clipboard sharing
-
Persistent home folder (
/home/zzh
) -
Non-root user
zzh
-
UTF-8 locale
Final Dockerfile
FROM ubuntu:24.04ENV DEBIAN_FRONTEND=noninteractive# Install base packages, dev tools, XFCE, and VNC RUN apt-get update && apt-get install -y \sudo \zsh \curl \git \nano \locales \vim \htop \python3 \python3-pip \nodejs \npm \xfce4 xfce4-terminal \thunar \tigervnc-standalone-server \tigervnc-common \&& rm -rf /var/lib/apt/lists/*# Set UTF-8 locale RUN locale-gen en_US.UTF-8 ENV LANG=en_US.UTF-8 ENV LANGUAGE=en_US:en ENV LC_ALL=en_US.UTF-8# Create non-root user 'zzh' with zsh shell RUN useradd -ms /bin/zsh zzh \&& usermod -aG sudo zzhUSER zzh WORKDIR /home/zzh# Install Oh My Zsh and set theme + aliases RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended \&& sed -i 's/ZSH_THEME=".*"/ZSH_THEME="agnoster"/' ~/.zshrc \&& echo 'alias ll="ls -alF"' >> ~/.zshrc \&& echo 'alias la="ls -A"' >> ~/.zshrc \&& echo 'alias l="ls -CF"' >> ~/.zshrc# Setup VNC password and persistent configuration RUN mkdir -p /home/zzh/.vnc \&& echo "1234" | vncpasswd -f > /home/zzh/.vnc/passwd \&& chmod 600 /home/zzh/.vnc/passwd# Persistent VNC startup script RUN echo "#!/bin/bash\nexport USER=zzh\nexport HOME=/home/zzh\nvncserver :1 -geometry 1280x800 -fg -localhost no -SecurityTypes VncAuth\n" \> /home/zzh/startvnc.sh \&& chmod +x /home/zzh/startvnc.sh# Expose VNC port EXPOSE 5901# Default shell SHELL ["/bin/zsh", "-c"]# Start VNC as non-root user on container start CMD ["/home/zzh/startvnc.sh"]
🔧 Build & Run
-
Build the image:
-
Run the container with persistent home:
-
Connect from Windows using a VNC client (TigerVNC Viewer):
-
Server:
localhost:5901
-
Password:
1234
-
Optional: Exec into container shell anytime:
You’ll be logged in as zzh
with zsh + Oh My Zsh ready.
✅ Features now:
-
XFCE GUI accessible via VNC
-
Persistent home folder mapped to Windows
-
zsh + Oh My Zsh with theme and aliases
-
Common dev tools installed
-
Clipboard sharing enabled via VNC
-
Non-root user by default
Here’s a ready-to-use docker-compose.yml
for your ubuntu-zzh-vnc
container. This will handle the image build, persistent volume, and port mapping, so you can start everything with one command.
docker-compose.yml
🔧 Usage
-
Make sure your
Dockerfile
anddocker-compose.yml
are in the same folder. -
Build and start the container:
-
Connect via VNC (TigerVNC Viewer):
-
Server:
localhost:5901
-
Password:
1234
-
Exec into the container shell if needed:
-
Stop the container: