Display Connection Errors
Error: cannot open display
Error: cannot open display
Error Message:Cause:This error occurs when the container cannot connect to your host system’s graphics server (X11 or Wayland via XWayland). Common causes include:
- The
xhost +local:dockercommand wasn’t run - The
DISPLAYenvironment variable isn’t being passed correctly - X11 socket isn’t mounted properly
Grant Display Access
Allow Docker containers to connect to your graphics server:
This command needs to be run in each new graphical session or after rebooting the system.
Verify DISPLAY Variable
Ensure the This should output something like
DISPLAY environment variable is set on your host::0 or :1.Check Docker Run Command
Verify your
docker run command includes these parameters:-e DISPLAY=$DISPLAYpasses the host’s DISPLAY variable to the container-v /tmp/.X11-unix:/tmp/.X11-unixmounts the X11 socket
Hardware Acceleration Errors
MESA: error: Failed to query drm device
MESA: error: Failed to query drm device
Error Message:Cause:This error indicates that the container cannot access your GPU’s Direct Rendering Infrastructure (DRI) devices. Hardware acceleration is not working.Solutions:
Verify DRI Device Flag
Ensure your The
docker run command includes the --device flag:--device /dev/dri:/dev/dri flag maps the host’s Direct Rendering Infrastructure devices into the container.Check DRI Devices Exist
Verify DRI devices exist on your host:You should see devices like
card0, renderD128, etc.glx: failed to create dri3 screen
glx: failed to create dri3 screen
Error Message:Cause:This error occurs when GLX (OpenGL Extension to the X Window System) cannot initialize DRI3 for hardware-accelerated rendering. This is a hardware acceleration issue.Solution:
failed to load driver: iris/radeon/etc.
failed to load driver: iris/radeon/etc.
Error Message:Cause:The container cannot load the specific graphics driver for your GPU (Intel Iris, AMD Radeon, NVIDIA, etc.). This is a hardware acceleration compatibility issue.Solution:
When to Use Each Rendering Mode
Hardware Acceleration
Use when:
- You need maximum performance
- Your GPU is compatible
- No driver errors occur
Software Rendering
Use when:
- Hardware acceleration fails
- You see MESA, DRM, GLX, or driver errors
- Compatibility is more important than performance
xhost Command Issues
xhost command not found
xhost command not found
Error Message:Cause:The
xhost utility is not installed on your system.Solution:Install the package that provides xhost for your distribution:xhost: unable to open display
xhost: unable to open display
Error Message:Cause:You’re trying to run
xhost from a non-graphical session (e.g., SSH, TTY console, or before the display server has started).Solution:Run from Graphical Session
Ensure you’re running the command from within a graphical session (desktop environment).
Verify DISPLAY Variable
Check that the If empty, you’re not in a graphical session.
DISPLAY environment variable is set: