Skip to content

Wiki

The graphical interface of the program inside the Docker container cannot pop up.

About 2 min read

(Come back and do this operation after you have successfully created the container.)

Temporarily allow X11 access: Run the following command on the host each time the system boots to allow X11 access: (However, running the command every time the system boots is cumbersome; you can write it as a script to start automatically at boot, see Autostart Applications and Scripts)

The command is as follows:

xhost +local:docker

The auto-start script is as follows:

#!/bin/bash
# 等待 X Server 就绪(最多等 10 秒)
for i in {1..10}; do
    if [ -n "$DISPLAY" ] && xset q >/dev/null 2>&1; then
        /usr/bin/xhost +local:docker
        exit 0
    fi
    sleep 1
done

The tutorial part is as follows: