惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
N
Netflix TechBlog - Medium
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
V
Visual Studio Blog
H
Help Net Security
Engineering at Meta
Engineering at Meta
Hugging Face - Blog
Hugging Face - Blog
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
博客园 - 【当耐特】
B
Blog
Stack Overflow Blog
Stack Overflow Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
博客园 - 司徒正美
博客园 - 叶小钗
Y
Y Combinator Blog
MyScale Blog
MyScale Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

Lei Mao's Log Book

2026 FIFA World Cup 备受嘲讽的会徽 Python Debugging Via VS Code In Docker Container Vargas Plateau Regional Park 徒步 Vargas Plateau Regional Park Apex 2026 FIFA World Cup 小组赛赛程 Retaining EXIF Metadata In GIMP San Francisquito Creek Joint Powers Authority 2025 Calendar Photo 麦当劳 The FIFA World Cup 套餐 Ardenwood Historic Farm 徒步 Ardenwood Historic Farm Synchronizations With TorchRec KeyedJaggedTensor Pacific Commons Linear Park 徒步 Pacific Commons Linear Park 2026 San Jose Half Marathon 竞赛 目标 Mountain View Shoreline Park 徒步 Mountain View Shoreline Park PyTorch AOTInductor Hybrid Lowering Carquinez Strait Regional Shoreline 徒步 Carquinez Strait Regional Shoreline PyTorch Triton Kernel Transparent Tracing and Compilation 脸庞 PyTorch Fake Export 2026 BRAIN Foundation 10K 竞赛 2026 Wild and Scenic Film Festival 参观 2026 Wild and Scenic Film Festival 系统工程程序员修 Bug FIFA 官方网站的语言 PyTorch Custom Operation
Docker Container GUI Display Using Wayland
Lei Mao · 2026-04-29 · via Lei Mao's Log Book

Introduction

Wayland is a modern display server protocol for Linux that aims to replace the older X11 protocol. Wayland provides a more efficient and secure way to handle graphical display on Linux systems.

Starting from Ubuntu 26.04 LTS, Wayland has become the default display server protocol, and X11 support has been completely dropped. In this blog post, I would like to discuss how to run GUI applications from Docker container using Wayland on Ubuntu 26.04 LTS.

Examples

Starting with version 121, Firefox defaults to Wayland on Linux. If Wayland is not available, it will fall back to X11. We will use Firefox in a Ubuntu 26.04 Docker container as an example to demonstrate how to run GUI applications from Docker container using Wayland.

Firefox on Ubuntu 26.04

We could slightly modify the Dockerfile of Firefox on Ubuntu 24.04 for Ubuntu 26.04. The modified Dockerfile is as follows.

firefox.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM ubuntu:26.04

ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8


RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
wget \
gpg \
dbus \
libwayland-client0 \
libwayland-egl1 \
fonts-wqy-microhei && \
apt-get clean


RUN install -d -m 0755 /etc/apt/keyrings && \
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null && \
gpg -n -q --import --import-options import-show /etc/apt/keyrings/packages.mozilla.org.asc | awk '/pub/{getline; gsub(/^ +| +$/,""); if($0 == "35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3") print "\nThe key fingerprint matches ("$0").\n"; else print "\nVerification failed: the fingerprint ("$0") does not match the expected one.\n"}' && \
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null && \
echo 'Package: *\nPin: origin packages.mozilla.org\nPin-Priority: 1000' | tee /etc/apt/preferences.d/mozilla && \
apt-get update && apt-get install -y --no-install-recommends \
firefox && \
apt-get clean

CMD ["firefox"]

To build the Docker image, please run the following command.

1
$ docker build -f firefox.Dockerfile -t firefox:26.04 .

Using Wayland

To start Firefox from the Docker container using Wayland, please run the following command. The operating system that hosts the Docker container must use Wayland as the display server protocol. In this case, I was running on Ubuntu 26.04 LTS which completely dropped support for X11 and only supports Wayland.

1
2
3
4
5
$ docker run -it --rm \
-e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
-v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY \
firefox:26.04

To verify that Firefox is running using Wayland, we could open the about:support page in Firefox and check the “Window Protocol” information. It should show “Wayland” instead of “X11”.

Using xWayland

To start Firefox from the Docker container using xWayland, i.e., the X11 compatibility layer for Wayland, please run the following command. The operating system that hosts the Docker container does not have to use Wayland as the display server protocol. In this case, Ubuntu 24.04 LTS or Ubuntu 26.04 LTS both worked.

1
2
3
4
5
6
$ xhost +
$ docker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
firefox:26.04
$ xhost -

To verify that Firefox is running using xWayland, we could open the about:support page in Firefox and check the “Window Protocol” information. It should show “X11” instead of “Wayland”, even if the host operating system is using Wayland as the display server protocol.

Conclusions

Wayland is the future of display server protocol for Linux. We should start using Wayland for GUI display as much as possible from now on.

References