This commit is contained in:
Kyattsukuro 2025-06-03 21:13:25 +02:00
commit 903e3e2e5a
4 changed files with 127 additions and 0 deletions

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM archlinux
ARG USER_ID=1000
ARG GROUP_ID=100
RUN cat >> /etc/pacman.conf <<EOF
[multilib]
Include = /etc/pacman.d/mirrorlist
EOF
RUN pacman -Syu --noconfirm && \
pacman -S --noconfirm --asdeps base-devel sudo vim \
pulseaudio-jack \
bubblewrap gnu-free-fonts amdvlk lib32-amdvlk steam
RUN cat > /etc/sudoers <<EOF
root ALL=(ALL:ALL) NOPASSWD: ALL
%users ALL=(ALL:ALL) NOPASSWD: ALL
EOF
RUN groupmod -g ${GROUP_ID} users
RUN useradd -m -g ${GROUP_ID} -u ${USER_ID} someone
COPY setup_runtime.sh /setup_runtime.sh
ENTRYPOINT ["/bin/bash", "/setup_runtime.sh"]

38
README.md Normal file
View File

@ -0,0 +1,38 @@
# docker-wayland-x-gui
This repository provides a reference setup to enable graphical applications (Wayland, X11, or XWayland) to be displayed on the host's compositor/display server. It also includes PipeWire and ALSA connections/pass-through for audio support.
## Features
* **Wayland, X11, and XWayland** app support
* **PipeWire** and **ALSA** integration for sound
* Launch GUI apps from a Docker container directly on your host display
* Configurable **UID/GID** and mount paths to match your host environment
## Prerequisites
* Docker installed and configured
* A Wayland-compatible host compositor (e.g., Sway, GNOME Shell, KDE, etc.)
* PipeWire and/or ALSA installed and running on the host
## Configuration Notes
Depending on your system setup, you may need to adjust:
* Mount paths for Wayland/X11 sockets, sound devices, and config directories
* UID/GID inside the container to match your host user
By default:
* **UID:** `1000`
* **GID:** `100`
These can be overridden using environment variables.
## Usage
You can launch apps from the host system into the running container using:
```bash
docker exec <container-name> <app>
```

53
compose.yaml Normal file
View File

@ -0,0 +1,53 @@
services:
archSysGui:
build:
context: .
dockerfile: Dockerfile
args:
- "USER_ID=${UID:-1000}"
- "GROUP_ID=${GID:-100}"
pull_policy: build
image: katzenkralle/archsysv2:latest
environment:
- GDK_BACKEND=wayland
- QT_QPA_PLATFORM=wayland
- WAYLAND_DISPLAY=$WAYLAND_DISPLAY
- XDG_BACKEND=wayland
- XDG_SESSION_TYPE=wayland
- XDG_RUNTIME_DIR=/tmp/xdg_runtime
- PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native
- DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus
- DISPLAY=$DISPLAY
# Needed by steam for user namespacing
cap_add:
- SYS_ADMIN
security_opt:
- seccomp=unconfined
volumes:
- $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/xdg_runtime/$WAYLAND_DISPLAY
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native
# Add further directories to the container as needed
- ~/.local/share/icons:/home/someone/.local/share/icons
- ~/.local/share/themes:/home/someone/.local/share/themes
- ~/.config:/home/someone/.config
- ~/.local/share/Steam/steamapps/:/home/someone/.local/share/Steam/steamapps/
- /mnt/DT01ACA1/SteamLibrary/:/mnt/DT01ACA1/SteamLibrary
- /mnt/DT01ACA3/SteamLibrary/:/mnt/DT01ACA3/SteamLibrary
ipc: host
user: ${UID:-1000}:${GID:-100}
# Alternativly use: LIBGL_ALWAYS_SOFTWARE=1 steam to launch steam, no GPU
devices:
- /dev/kfd
- /dev/dri
- /dev/snd # ALSA sound

10
setup_runtime.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/share/env bash
user=$(id -u)
group=$(id -g)
mkdir -p $XDG_RUNTIME_DIR > /dev/null 2>&1
sudo chown "$user:$group" $XDG_RUNTIME_DIR > /dev/null 2>&1
dbus-daemon --config-file=/usr/share/dbus-1/session.conf --address=$(echo "$DBUS_SESSION_BUS_ADDRESS" | sed 's/"/\\"/g') --print-address;
while true; do sleep 1000; done