Created
March 15, 2026 20:24
-
-
Save franckverrot/cbaf471a4cb1c8981dc8f260d5a0aa3b to your computer and use it in GitHub Desktop.
Running Graphical Apps in Apple's Container Tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ubuntu:24.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN apt-get update && apt-get install -y \ | |
| tigervnc-standalone-server novnc websockify \ | |
| fluxbox xterm dbus-x11 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m vncuser | |
| USER vncuser | |
| WORKDIR /home/vncuser | |
| # Set VNC password non-interactively | |
| RUN mkdir -p /home/vncuser/.vnc && \ | |
| echo "mypassword" | vncpasswd -f > /home/vncuser/.vnc/passwd && \ | |
| chmod 600 /home/vncuser/.vnc/passwd && \ | |
| printf '#!/bin/sh\nexec fluxbox\n' > /home/vncuser/.vnc/xstartup && \ | |
| chmod +x /home/vncuser/.vnc/xstartup | |
| USER root | |
| COPY <<'EOF' /start.sh | |
| #!/bin/sh | |
| su - vncuser -c "vncserver :1 -geometry 1920x1080 -depth 24 -localhost no" | |
| # Wait for VNC to actually be listening | |
| echo "Waiting for VNC server..." | |
| for i in $(seq 1 30); do | |
| if [ -e /tmp/.X11-unix/X1 ]; then | |
| echo "VNC server is ready." | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| # Start websockify in foreground (keeps container alive) | |
| exec websockify --web /usr/share/novnc 6080 localhost:5901 | |
| EOF | |
| RUN chmod +x /start.sh | |
| EXPOSE 5901 6080 | |
| CMD ["/start.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment