### Example: Run Desktop Environment Source: https://github.com/mviereck/x11docker/blob/master/README.md Starts a desktop environment from the x11docker/xfce image using the --desktop option. ```bash x11docker --desktop x11docker/xfce ``` -------------------------------- ### Example: Run LXDE with specific size Source: https://github.com/mviereck/x11docker/blob/master/README.md Starts the LXDE desktop environment from the x11docker/lxde image with a specified size of 320x240 pixels. This requires the Xephyr nested X server. ```bash x11docker --desktop --size 320x240 x11docker/lxde ``` -------------------------------- ### Install x11docker from Cloned Repository Source: https://context7.com/mviereck/x11docker/llms.txt Install x11docker after cloning the repository. Navigate into the cloned directory and run the install script with sudo. ```bash git clone https://github.com/mviereck/x11docker.git cd x11docker sudo ./x11docker --install ``` -------------------------------- ### Example: Run FVWM with xterm Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches xterm from the x11docker/fvwm image. ```bash x11docker x11docker/fvwm xterm ``` -------------------------------- ### Example: Run xfce Thunar Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the Thunar file manager from the x11docker/xfce image. ```bash x11docker x11docker/xfce thunar ``` -------------------------------- ### Customize x11docker Image with Dockerfile Source: https://github.com/mviereck/x11docker/blob/master/README.md Example Dockerfile to create a custom x11docker image. This example starts from the x11docker/xfce image and installs VLC media player. ```dockerfile # xfce desktop with VLC media player FROM x11docker/xfce RUN apt-get update && apt-get install -y vlc ``` -------------------------------- ### Install x11docker from GitHub Source: https://context7.com/mviereck/x11docker/llms.txt Quickly install or update x11docker by piping the script to bash with sudo. The '--update' flag ensures the latest version is installed. ```bash curl -fsSL https://raw.githubusercontent.com/mviereck/x11docker/master/x11docker | sudo bash -s -- --update ``` -------------------------------- ### Install tini-static replacement Source: https://github.com/mviereck/x11docker/wiki/Init-systems Provides steps to download and install tini-static if the host's docker package is missing the default /usr/bin/docker-init. Ensure the file is executable. ```shell mkdir -p ~/.local/share/x11docker cd ~/.local/share/x11docker wget https://github.com/krallin/tini/releases/download/v0.18.0/tini-static chmod +x tini-static ``` -------------------------------- ### Start X Server with Xephyr Source: https://github.com/mviereck/x11docker/wiki/Short-setups-to-provide-X-display-to-container This command starts an Xephyr X server instance. It specifies the display number, authentication cookie, disables certain extensions for stability, and sets the screen resolution and depth. ```bash Xcommand="/usr/bin/Xephyr :$Newdisplaynumber \ -auth $Xservercookie \ -extension MIT-SHM \ -nolisten tcp \ -screen 1000x750x24 \ -retro" ``` -------------------------------- ### Run x11docker Session with VNC Source: https://github.com/mviereck/x11docker/wiki/VNC This script sets up an x11docker session with VNC. It first retrieves environment variables for the session and then starts the x11vnc server. Ensure you have x11docker and x11vnc installed. To connect, use `vncviewer localhost:5910` in another terminal. ```bash #! /bin/bash read Xenv < <(x11docker --xvfb --printenv --showenv x11docker/lxde) env $Xenv x11vnc -noshm -forever -localhost -rfbport 5910 ``` -------------------------------- ### Run x11docker with runit init Source: https://github.com/mviereck/x11docker/wiki/Init-systems Starts an x11docker container with runit as the init system. ```shell x11docker --init=runit --desktop x11docker/enlightenment ``` -------------------------------- ### Example: GPU Hardware Acceleration Source: https://github.com/mviereck/x11docker/blob/master/README.md Runs glxgears from the x11docker/xfce image with GPU hardware acceleration enabled using the --gpu option. ```bash x11docker --gpu x11docker/xfce glxgears ``` -------------------------------- ### Create a default preset Source: https://context7.com/mviereck/x11docker/llms.txt Creates a default preset file that is automatically applied to all x11docker sessions. This example sets the backend to podman. ```bash cat > ~/.config/x11docker/preset/default << 'EOF' --backend=podman EOF ``` -------------------------------- ### Configure Xwrapper.config for Xorg Source: https://github.com/mviereck/x11docker/wiki/Setup-for-option---xorg Replace the default allowed_users setting to permit non-console users to start X servers. ```text allowed_users=console ``` ```text allowed_users=anybody needs_root_rights=yes ``` -------------------------------- ### Run X server for build interaction Source: https://github.com/mviereck/x11docker/wiki/docker-build-with-interactive-GUI Starts an X server using Xephyr to obtain the DISPLAY variable required for the build process. ```bash $ x11docker --xephyr --printenv --xoverip --no-auth --display=30 DISPLAY=172.17.0.1:30 XDG_RUNTIME_DIR=/run/user/1000 ``` -------------------------------- ### Test Insecure Setup and Features Source: https://context7.com/mviereck/x11docker/llms.txt Test potentially insecure configurations like '--hostdisplay' and '--gpu', or run with various features like '--pulseaudio', '--webcam', etc. ```bash x11docker --hostdisplay --gpu x11docker/check ``` ```bash x11docker --pulseaudio --webcam --clipboard --printer x11docker/check ``` -------------------------------- ### Install MESA Drivers on Alpine/NixOS Source: https://github.com/mviereck/x11docker/wiki/Hardware-acceleration Install MESA demo packages and specific drivers for hardware acceleration on Alpine and NixOS Docker images. ```bash mesa-demos mesa-dri-ati mesa-dri-intel mesa-dri-nouveau mesa-dri-swrast ``` -------------------------------- ### Install x11docker as root Source: https://github.com/mviereck/x11docker/blob/master/README.md Use this command to download and install the latest x11docker version when running directly as the root user. ```sh curl -fsSL https://raw.githubusercontent.com/mviereck/x11docker/master/x11docker | bash -s -- --update ``` -------------------------------- ### Create application image from NVIDIA base Source: https://github.com/mviereck/x11docker/wiki/NVIDIA-driver-support-for-docker-container Example Dockerfile demonstrating how to build an application image using the previously created NVIDIA base image. ```dockerfile FROM x11docker/nvidia-base RUN apt-get update && apt-get install -y xterm CMD xterm ``` -------------------------------- ### Insecure x11docker Setup for Speed Source: https://github.com/mviereck/x11docker/blob/master/README.md Use this setup if container isolation is not a concern and maximum speed is desired. It shares the host X socket and enables GPU access without additional security measures. ```bash x11docker --hostdisplay --gpu ``` -------------------------------- ### Run x11docker with systemd init Source: https://github.com/mviereck/x11docker/wiki/Init-systems Example of launching an x11docker container with systemd as the init system. This option may share cgroups with the container. ```shell x11docker --init=systemd --desktop x11docker/lxde ``` -------------------------------- ### Desktop entry for x11docker with --xorg Source: https://github.com/mviereck/x11docker/wiki/Display-manager-entry-for-x11docker Desktop entry file to be placed in /usr/share/wayland-sessions for the --xorg setup. ```ini [Desktop Entry] Name=x11docker/xfce (--xorg) Comment=Xfce in docker image Exec=/usr/local/bin/x11docker-xfce-xorg Terminal=false Type=Application ``` -------------------------------- ### Install MESA Drivers on Arch Linux Source: https://github.com/mviereck/x11docker/wiki/Hardware-acceleration Install MESA demo packages for hardware acceleration on Arch Linux-based Docker images. ```bash mesa-demos ``` -------------------------------- ### Automated Xpra setup script Source: https://github.com/mviereck/x11docker/wiki/Remote-access-with-SSH A script executed on the client to automate remote x11docker and xpra startup. ```bash #! /bin/bash HOSTNAME=localhost # Change to desired server address IMAGECOMMAND="x11docker/lxde lxterminal" # Change to desired image name and command # Runs x11docker on remote server. Reads new X environment variables from its output. # (for X server options other than --xvfb or --xdummy add options --showenv --xtest). read Xenv < <(ssh -f $HOSTNAME -- x11docker --xvfb --printenv $IMAGECOMMAND) # extract DISPLAY from new X environment Newdisplay=$(sh -c "export $Xenv ; echo \$DISPLAY") # start remote xpra server # (replace "xpra start" with "xpra start-desktop" for desktop environments) ssh $HOSTNAME -- env $Xenv xpra start $Newdisplay --use-display --start-via-proxy=no # start local xpra client xpra attach ssh://$HOSTNAME/$Newdisplay ``` -------------------------------- ### Start X Server with TCP Listening Enabled Source: https://github.com/mviereck/x11docker/wiki/How-to-access-X-over-TCP-IP-network Enable TCP/IP access for an X server using the -listen tcp option. Note that this is deprecated and insecure by default. ```bash Xephyr :2 -listen tcp & sleep 1 DISPLAY=127.0.0.1:2 xterm ``` -------------------------------- ### Create Desktop Launcher Source: https://context7.com/mviereck/x11docker/llms.txt Generate a desktop launcher for x11docker to easily start containers from your desktop environment. ```bash x11docker --launcher --desktop x11docker/xfce ``` -------------------------------- ### Install MESA Drivers on Debian/Ubuntu Source: https://github.com/mviereck/x11docker/wiki/Hardware-acceleration Install the necessary MESA utilities for hardware acceleration on Debian and Ubuntu-based Docker images. ```bash mesa-utils mesa-utils-extra ``` -------------------------------- ### Start X Server with Empty Cookie File Source: https://github.com/mviereck/x11docker/wiki/X-authentication-with-cookies-and-xhost-("No-protocol-specified"-error) Initiate an X server (Xephyr) with an empty cookie file. This allows the server to run without initial access restrictions until a cookie is generated. ```bash Cookiefile=~/mycookie Displaynumber=100 rm $Cookiefile Xephyr :$Displaynumber -auth $Cookiefile ``` -------------------------------- ### Desktop entry for x11docker with --hostdisplay Source: https://github.com/mviereck/x11docker/wiki/Display-manager-entry-for-x11docker Desktop entry file to be placed in /usr/share/xsessions for the --hostdisplay setup. ```ini [Desktop Entry] Name=x11docker/xfce (--hostdisplay) Comment=Xfce in docker image Exec=/usr/local/bin/x11docker-xfce-hostdisplay Terminal=false Type=Application ``` -------------------------------- ### Register foreign architectures with qus Source: https://github.com/mviereck/x11docker/wiki/Multiarch-setups-with-QEMU A shortcut command to enable support for multiple architectures without installing a full QEMU package on the host. ```bash docker run --rm --privileged aptman/qus -s -- -p ``` -------------------------------- ### Run GUI App from Docker Image Source: https://context7.com/mviereck/x11docker/llms.txt Basic syntax to run any graphical application from a Docker image. x11docker automatically handles X server setup. ```bash x11docker IMAGE [COMMAND] ``` ```bash x11docker x11docker/xfce xfce4-terminal ``` ```bash x11docker jess/firefox ``` ```bash x11docker x11docker/xfce thunar ``` -------------------------------- ### Start Only an Empty X Server Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Use this command to launch an isolated X server without running any specific application. This is useful for testing X server configurations or as a base for other tools. ```bash x11docker [OPTIONS] --xonly ``` -------------------------------- ### Share Webcam Source: https://github.com/mviereck/x11docker/blob/master/README.md Use the --webcam option to share host webcams with the container. If webcam applications fail, consider installing --gpu dependencies in the image. ```bash x11docker --webcam ``` -------------------------------- ### Create a multimedia preset file Source: https://context7.com/mviereck/x11docker/llms.txt Demonstrates creating a reusable preset configuration file for multimedia applications. Options like GPU, webcam, printer, PipeWire, clipboard, and shared directories are included. ```bash cat > ~/.config/x11docker/preset/multimedia << 'EOF' --gpu --webcam --printer --pipewire --clipboard --share ~/Videos --share ~/Music EOF ``` -------------------------------- ### Configure Xinitrc for X11 Forwarding Source: https://github.com/mviereck/x11docker/wiki/Short-setups-to-provide-X-display-to-container This script configures the .xinitrc file, setting up environment variables for DISPLAY and XAUTHORITY, configuring keyboard layout, generating X authentication cookies, and starting a window manager and Docker. ```bash { echo "#! /bin/bash" echo "# set environment variables to new display and new cookie" echo "export DISPLAY=:$Newdisplaynumber" echo "export XAUTHORITY=$Xclientcookie" echo "# same keyboard layout as on host" echo "echo '$(setxkbmap -display $DISPLAY -print)' | xkbcomp - :$Newdisplaynumber" echo "# create new XAUTHORITY cookie file" echo ":> $Xclientcookie" echo "xauth add :$Newdisplaynumber . $(mcookie)" echo "# create prepared cookie with localhost identification disabled by ffff," echo "# needed if X socket is shared instead connecting over tcp. ffff means 'familiy wild'" echo 'Cookie=$(xauth nlist ":$Newdisplaynumber | sed -e s/^..../ffff/)' echo 'echo $Cookie | xauth -f \ ``` ```bash $Xclientcookie" nmerge -" echo "cp $Xclientcookie $Xservercookie" echo "chmod 644 $Xclientcookie" echo "# run window manager in Xephyr" echo $Windowmanager' & Windowmanagerpid=$!' echo "# show docker log" echo 'tail --retry -n +1 -F '$Dockerlogfile' 2>/dev/null & Tailpid=$!' echo "# run docker" echo "$Dockercommand" } > $Xinitrc ``` -------------------------------- ### Indicate Desktop Environment Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Use the -d or --desktop option when the container image is configured to run a desktop environment. This helps x11docker optimize the setup for desktop usage. ```bash x11docker -d IMAGE ``` -------------------------------- ### Run LXQt Desktop with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the LXQt desktop environment. ```bash x11docker --desktop x11docker/lxqt ``` -------------------------------- ### Run Mate Desktop with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the Mate desktop environment. ```bash x11docker --desktop x11docker/mate ``` -------------------------------- ### Webcam with systemd init Source: https://context7.com/mviereck/x11docker/llms.txt Combines webcam sharing with systemd as the init system, which is required for certain applications like cheese. Run with a specific image. ```bash x11docker --webcam --init=systemd x11docker/xfce cheese ``` -------------------------------- ### Install MESA Drivers on CentOS/Fedora Source: https://github.com/mviereck/x11docker/wiki/Hardware-acceleration Install the required MESA drivers and utilities for hardware acceleration on CentOS and Fedora-based Docker images. ```bash glx-utils mesa-dri-drivers ``` -------------------------------- ### Run Wayland Environment Source: https://github.com/mviereck/x11docker/blob/master/README.md Use the --wayland option to set up a Wayland environment. It respects the --desktop option. ```bash x11docker --wayland ``` -------------------------------- ### Run with systemd init for desktop apps Source: https://context7.com/mviereck/x11docker/llms.txt Uses systemd as the init system, which is necessary for some desktop applications. Requires desktop mode. Run with a specific image. ```bash x11docker --desktop --init=systemd x11docker/gnome ``` -------------------------------- ### Xorg Permission Error Message Source: https://github.com/mviereck/x11docker/wiki/Setup-for-option---xorg Example of the error message encountered when Xorg permissions are insufficient. ```text (EE) xf86OpenConsole: Cannot open virtual console 8 (Permission denied) ``` -------------------------------- ### Configure x11docker for packaging Source: https://github.com/mviereck/x11docker/wiki/Packaging-x11docker Disable internal installation and update features by modifying the Packagedversion variable in the script. ```bash Packagedversion="yes" ``` -------------------------------- ### Run with tini init system Source: https://context7.com/mviereck/x11docker/llms.txt Runs the container with tini as the init system, which is the default and provides minimal process management. Use with a specific image. ```bash x11docker --init=tini x11docker/xfce ``` -------------------------------- ### Configure SSH server inside a container Source: https://github.com/mviereck/x11docker/wiki/Remote-access-with-SSH Start a container with an SSH server and retrieve connection details. ```bash --runasroot /usr/sbin/sshd --network --cap-default -- -p 8022:22 -- ``` ```bash read infofile < <(x11docker --printinfofile --runasroot /usr/sbin/sshd --network --cap-default -- -p 8022:22 -- IMAGE) cat $infofile ip="$(cat $infofile | grep containerip | cut -d= -f2)" ``` ```bash ssh -Y $ip ``` ```bash source /x11docker/sshenv ``` -------------------------------- ### Add Container User to Group Source: https://context7.com/mviereck/x11docker/llms.txt Add the container user to a specific group, for example, 'video' for hardware access. ```bash x11docker --group-add=video x11docker/xfce ``` -------------------------------- ### Use xpra for seamless window integration Source: https://context7.com/mviereck/x11docker/llms.txt Recommends using xpra for seamless window integration. Run with a specific image and application. ```bash x11docker --xpra x11docker/xfce xterm ``` -------------------------------- ### Setup Xpra remote session Source: https://github.com/mviereck/x11docker/wiki/Remote-access-with-SSH Commands for server-side and client-side Xpra configuration to allow detaching and reattaching sessions. ```bash #! /bin/bash # Run invisible Xvfb X server with display number :30. # Catches X environment with 'read < <(...)' construct. # Docker container runs on invisible Xvfb display. # (for X server options other than --xvfb or --xdummy also add options --showenv and --xtest). read Xenv < <(x11docker --xvfb --printenv --display=30 x11docker/lxde pcmanfm) # Output of new X environment, just for info # (You can drop `--display=30` in command above if you provide DISPLAY # from this output to following xpra commands instead of :30) echo $Xenv # Start xpra server with new environment variables. # (Replace "start" with "start-desktop" to forward a desktop environment) env $Xenv xpra start :30 --use-display --start-via-proxy=no --daemon=no ``` ```bash # Attach xpra client over SSH to xpra server. # Replace SERVERIP with IP or host name of ssh server. # You might need to specify a user name in the form USER@SERVERIP xpra attach ssh://SERVERIP/30 ``` ```bash xpra detach ssh://SERVERIP/30 ``` ```bash xpra stop ssh://SERVERIP/30 ``` -------------------------------- ### Run Lumina Desktop with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the Lumina desktop environment, based on Void Linux. ```bash x11docker --desktop x11docker/lumina ``` -------------------------------- ### Detect NVIDIA driver version on host Source: https://github.com/mviereck/x11docker/wiki/NVIDIA-driver-support-for-docker-container Command to identify the currently installed NVIDIA driver version on the host system. ```bash head -n1 ``` -------------------------------- ### Run Host Application with Command and Arguments Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Run a host application with specific arguments, utilizing a new X server provided by x11docker. This command structure supports passing arguments directly. ```bash x11docker [OPTIONS] --backend=host -- COMMAND [ARG1 ARG2 ...] ``` -------------------------------- ### Run Gnome 3 Desktop with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the Gnome 3 desktop environment with GPU acceleration and systemd initialization. ```bash x11docker --desktop --gpu --init=systemd x11docker/gnome ``` -------------------------------- ### Extended Xephyr automation script Source: https://github.com/mviereck/x11docker/wiki/Short-setups-to-provide-X-display-to-container A bash script to automate the setup of a nested Xephyr display, including cookie generation and user mapping for improved security. ```bash #! /bin/bash # # Xephyrdocker: Example script to run docker GUI applications in Xephyr. # # Usage: # Xephyrdocker WINDOWMANAGER DOCKERIMAGE [IMAGECOMMAND [ARGS]] # # WINDOWMANAGER host window manager for use with single GUI applications. # To run without window manager from host, use ":" # DOCKERIMAGE docker image containing GUI applications or a desktop # IMAGECOMMAND command to run in image # Windowmanager="$1" && shift Dockerimage="$*" # Container user Useruid=$(id -u) Usergid=$(id -g) Username="$(id -un)" [ "$Useruid" = "0" ] && Useruid=1000 && Usergid=1000 && Username="user$Useruid" # Find free display number for ((Newdisplaynumber=1 ; Newdisplaynumber <= 100 ; Newdisplaynumber++)) ; do [ -e /tmp/.X11-unix/X$Newdisplaynumber ] || break done Newxsocket=/tmp/.X11-unix/X$Newdisplaynumber # Cache folder and files Cachefolder=/tmp/Xephyrdocker_X$Newdisplaynumber [ -e "$Cachefolder" ] && rm -R "$Cachefolder" mkdir -p $Cachefolder Xclientcookie=$Cachefolder/Xcookie.client Xservercookie=$Cachefolder/Xcookie.server Xinitrc=$Cachefolder/xinitrc Etcpasswd=$Cachefolder/passwd # Command to run docker # --rm Created container will be discarded. # -e DISPLAY=$Newdisplay Set environment variable to new display. # -e XAUTHORITY=/Xcookie Set environment variable XAUTHORITY to provided cookie. # -v $Xclientcookie:/Xcookie:ro Provide cookie file to container. # -v $NewXsocket:$NewXsocket:ro Share new X socket of Xephyr. # --user $Useruid:$Usergid Security: avoid root in container. # -v $Etcpasswd:/etc/passwd:ro Share custom /etc/passwd file with user entry. ``` -------------------------------- ### Set default backend configuration Source: https://github.com/mviereck/x11docker/wiki/Packaging-x11docker Define the default container backend by creating a preset file. ```bash $ cat /etc/x11docker/preset/default --backend=podman ``` -------------------------------- ### Run KDE Plasma on X with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the KDE Plasma desktop environment on X11, enabling GPU acceleration and systemd initialization. ```bash x11docker --desktop --gpu --init=systemd x11docker/kde-plasma ``` -------------------------------- ### Access X Server via TCP/IP Source: https://github.com/mviereck/x11docker/wiki/How-to-access-X-over-TCP-IP-network Connect to an X server over TCP/IP using a specified display number. This may require additional X authentication setup. ```bash DISPLAY=127.0.0.1:111 xterm ``` -------------------------------- ### Run Trinity Desktop with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the Trinity desktop environment, a successor to KDE 3. ```bash x11docker --desktop x11docker/trinity ``` -------------------------------- ### Run Application on Host Wayland Desktop Source: https://github.com/mviereck/x11docker/blob/master/README.md Use the --hostwayland option to run applications seamlessly on host Wayland desktops like Gnome 3, KDE 5, and Sway. ```bash x11docker --hostwayland ``` -------------------------------- ### Run DBus User Daemon with dbus-launch Source: https://github.com/mviereck/x11docker/wiki/How-to-connect-container-to-DBus-from-host To run a DBus user daemon within a container without x11docker or host connection, use dbus-launch or dbus-run-session to start your command. ```bash dbus-launch --exit-with-session your_command ``` -------------------------------- ### Run LXDE with Wine and Pulseaudio with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches LXDE with Wine and PlayOnLinux, a persistent HOME folder, and Pulseaudio sound support. ```bash x11docker --desktop --home --pulseaudio x11docker/lxde-wine ``` -------------------------------- ### Use podman backend for rootless operation Source: https://context7.com/mviereck/x11docker/llms.txt Selects the podman backend, recommended for rootless container operation. Run with a specific image. ```bash x11docker --backend=podman x11docker/xfce ``` -------------------------------- ### Use Tini Init System (Default) Source: https://github.com/mviereck/x11docker/blob/master/README.md x11docker uses 'tini' as the default init system (PID 1) in the container to handle zombie reaping. No specific option is needed to enable this default behavior. ```bash x11docker --init ``` -------------------------------- ### Run Desktop Environment in Container Source: https://context7.com/mviereck/x11docker/llms.txt Use the --desktop flag to run full desktop environments. Options include persistent home folders, GPU acceleration, and init systems like systemd. ```bash x11docker --desktop x11docker/xfce ``` ```bash x11docker --desktop --home x11docker/lxde ``` ```bash x11docker --desktop --gpu --init=systemd x11docker/kde-plasma ``` ```bash x11docker --desktop --gpu --init=systemd x11docker/gnome ``` ```bash x11docker --desktop --size 1280x720 x11docker/xfce ``` -------------------------------- ### Enable GPU Hardware Acceleration Source: https://context7.com/mviereck/x11docker/llms.txt Enable OpenGL hardware acceleration with the --gpu option. This is beneficial for 3D applications and desktop environments. Note: NVIDIA proprietary drivers may require additional setup using the --runtime=nvidia option. ```bash x11docker --gpu x11docker/xfce glxgears ``` ```bash x11docker --gpu x11docker/xfce glxinfo | grep "OpenGL renderer" ``` ```bash x11docker --desktop --gpu x11docker/xfce ``` ```bash x11docker --gpu --weston-xwayland x11docker/xfce glxgears ``` ```bash x11docker --gpu --runtime=nvidia nvidia/cuda glxinfo ``` -------------------------------- ### Run LiriOS Desktop with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the LiriOS desktop environment, based on Fedora, with GPU acceleration enabled. ```bash x11docker --desktop --gpu lirios/unstable ``` -------------------------------- ### Run X Server with Custom Cookie Source: https://github.com/mviereck/x11docker/wiki/X-authentication-with-cookies-and-xhost-("No-protocol-specified"-error) Launch an X server (Xephyr) with a specified cookie file for authentication. Ensure the display number is not in use. ```bash # $Displaynumber must not be in use in ~/tmp/.X11-unix Xephyr :$Displaynumber -auth $Cookiefile ``` -------------------------------- ### Connect to Avahi Daemon from Host Source: https://github.com/mviereck/x11docker/wiki/How-to-connect-container-to-DBus-from-host This snippet demonstrates how to connect to the Avahi daemon running on the host system from within a container, as figured out by @syncplz. ```bash https://github.com/mviereck/x11docker/issues/271 ``` -------------------------------- ### Run Fluxbox Desktop with x11docker Source: https://github.com/mviereck/x11docker/blob/master/README.md Launches the Fluxbox window manager, a lightweight option based on Debian. ```bash x11docker --desktop x11docker/fluxbox ``` -------------------------------- ### Enable PipeWire Sound Source: https://github.com/mviereck/x11docker/blob/master/README.md Use the --pipewire option to enable PipeWire sound. Requires PipeWire on both host and image, and potentially pipewire-pulse and pipewire-alsa. ```bash x11docker --pipewire ``` -------------------------------- ### Run x11docker with OpenRC init Source: https://github.com/mviereck/x11docker/wiki/Init-systems Launches an x11docker container using OpenRC as the init system. Cgroup sharing is possible with the --sharecgroup option. ```shell x11docker --init=openrc --desktop x11docker/fvwm ``` -------------------------------- ### Show License Information Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Display the license information for x11docker (MIT License) and exit. This is useful for understanding the terms of use. ```bash x11docker --license ``` -------------------------------- ### Set Up Persistent Storage with Home Folders Source: https://context7.com/mviereck/x11docker/llms.txt Use the --home flag to create persistent storage for container data, typically stored in ~/.local/share/x11docker/. You can also use --share to mount specific host folders into the container, with an option for read-only mounts. ```bash x11docker --home xorilog/telegram ``` ```bash x11docker --home=/path/to/custom/folder x11docker/xfce ``` ```bash x11docker --share=/path/to/data x11docker/xfce ``` ```bash x11docker --share=/path/to/data:ro x11docker/xfce ``` ```bash x11docker --home=$HOME x11docker/xfce ``` -------------------------------- ### Enable ALSA Sound Card Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Configure sound output using ALSA by specifying the desired sound card with the --alsa option. List available sound cards using 'aplay -l'. ```bash x11docker --alsa=hw:0,0 IMAGE ``` -------------------------------- ### Enable Wayland Environment Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Set up a Wayland environment within the container using the -W or --wayland option. This is necessary for running Wayland-native applications. ```bash x11docker -W IMAGE ``` -------------------------------- ### Run x11docker with SysVinit init Source: https://github.com/mviereck/x11docker/wiki/Init-systems Launches an x11docker container using SysVinit as the init system. This has been tested with Devuan and Debian Buster images. ```shell x11docker --init=sysvinit --desktop ``` -------------------------------- ### Weston with Xwayland and GPU support Source: https://context7.com/mviereck/x11docker/llms.txt Uses Weston with Xwayland for good GPU support. Run with a specific image and application. ```bash x11docker --weston-xwayland --gpu x11docker/xfce glxgears ``` -------------------------------- ### Define Default x11docker Backend Source: https://github.com/mviereck/x11docker/blob/master/README.md Set a default backend for all x11docker sessions by creating a default preset file. ```text --backend=podman ``` -------------------------------- ### Define x11docker Multimedia Preset Source: https://github.com/mviereck/x11docker/blob/master/README.md Create a preset file to bundle common multimedia-related x11docker options. ```text --gpu --webcam --printer --pipewire --clipboard --share ~/Videos --share ~/Music ``` -------------------------------- ### Use Systemd Init System Source: https://github.com/mviereck/x11docker/blob/master/README.md Use the --init=systemd option to specify systemd as the init system (PID 1) in the container. This helps manage services and resolve the zombie reaping issue. ```bash x11docker --init=systemd ``` -------------------------------- ### Run Xterm with XAUTHORITY Cookie Source: https://github.com/mviereck/x11docker/wiki/How-to-access-X-over-TCP-IP-network Launch an X client like `xterm` using a specific `DISPLAY` and `XAUTHORITY` file. This demonstrates how to connect to an X server authenticated by a cookie. ```bash DISPLAY=127.0.0.1:111 XAUTHORITY=~/mycookie xterm ``` -------------------------------- ### Enable Pulseaudio Sound Source: https://github.com/mviereck/x11docker/blob/master/README.md Use the --pulseaudio option for Pulseaudio sound. Requires Pulseaudio on the host and Pulseaudio client libraries in the image. ```bash x11docker --pulseaudio ``` -------------------------------- ### Run host application on new X server Source: https://context7.com/mviereck/x11docker/llms.txt Runs a host application directly without using a container, effectively on a new X server. Use with an application command. ```bash x11docker --backend=host xterm ``` -------------------------------- ### Enable Rootless Backend Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Use the --rootless option to enforce running the container backend in rootless mode, enhancing security. This is particularly recommended for Podman. ```bash x11docker --rootless --backend=podman IMAGE ``` -------------------------------- ### Enable Arbitrary Xhost Access (Not Recommended) Source: https://github.com/mviereck/x11docker/wiki/How-to-access-X-over-TCP-IP-network Use `xhost +` to disable all access control, allowing clients from any host to connect. This is generally insecure and should be avoided. ```bash $ # DEAR CHILDS, DON'T TRY THIS AT HOME $ xhost + access control disabled, clients can connect from any host ``` -------------------------------- ### Define x11docker Deepin Desktop Preset Source: https://github.com/mviereck/x11docker/blob/master/README.md Create a preset file to encapsulate complex desktop environment configurations. ```text --desktop --init=systemd --gpu --pulseaudio --home -- --cap-add=IPC_LOCK -- x11docker/deepin ``` -------------------------------- ### Execute Xinit with Xinitrc and X command Source: https://github.com/mviereck/x11docker/wiki/Short-setups-to-provide-X-display-to-container This command initiates the X session using the configured Xinitrc script and the X server command. ```bash xinit $Xinitrc -- $Xcommand ``` -------------------------------- ### x11docker X Server Options Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Options for configuring the X server within the container. ```APIDOC ## X Server Options ### Description Options to select and configure the X server used within the container. ### Options - **--auto** (boolean) - Automatically choose X server (default). Influenced by other options like --desktop, --gpu, --wayland, --wm, --xw. - **-h, --hostdisplay** (boolean) - Share host display :0. Offers minimal container isolation. - **-a, --xpra** (boolean) - Use Xpra as a nested X server, supporting seamless and --desktop modes. Works on X11 and Wayland. - **--xpra2** (boolean) - Similar to --xpra, but runs the xpra client on the host. - **-A, --xpra-xwayland** (boolean) - Use Xpra with Wayland support, compatible with --gpu option. - **--xpra2-xwayland** (boolean) - Similar to --xpra-xwayland, but runs the xpra client on the host. - **-n, --nxagent** (boolean) - Use NxAgent as a nested X server, supporting seamless and --desktop modes. Potentially faster than Xpra but may have compositing issues. - **-y, --xephyr** (boolean) - Use Xephyr as a nested X server for --desktop mode. Without --desktop, it provides a host window manager via --wm. - **-Y, --weston-xwayland** (boolean) - Opens a Weston window with Xwayland. Supports --gpu. Can start up with --gpu in some environments. Provides Weston's window manager and X access. With --wayland, X11 and Wayland apps can run side-by-side. - **-x, --xorg** (boolean) - Use the core Xorg server. Runs from the console. Switch TTYs with .... Always switch to a black TTY before switching to X to avoid crashes. - **--satellite** (boolean) - Use rootless Xwayland (x11docker/xserver-satellite). Requires a running Wayland compositor. - **-X, --xwayland** (boolean) - Use rootful Xwayland. Requires a running Wayland compositor. ``` -------------------------------- ### Run container with PipeWire socket sharing Source: https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio Mounts the host PipeWire and PulseAudio sockets into the container and sets the required environment variables. ```bash docker run --rm \ -v $XDG_RUNTIME_DIR/pipewire-0:/tmp/pipewire-0 \ -e PIPEWIRE_RUNTIME_DIR=/tmp \ -v $XDG_RUNTIME_DIR/pulse/native:/tmp/pulse.socket \ -e PULSE_SERVER=/tmp/pulse.socket ... ``` -------------------------------- ### Run Host Application in New X Server Source: https://github.com/mviereck/x11docker/wiki/x11docker-options-overview Execute a command on the host system, but render its GUI within a new X server managed by x11docker. This is useful for isolating host applications. ```bash x11docker [OPTIONS] --backend=host COMMAND ```