docker-nvidia-egl-desktop

docker-nvidia-egl-desktop

基于KDE Plasma的NVIDIA GPU云桌面容器

docker-nvidia-egl-desktop是一个基于KDE Plasma的云桌面容器,为Kubernetes环境优化。项目支持OpenGL EGL/GLX、Vulkan和Wine/Proton,通过WebRTC和HTML5技术为NVIDIA GPU提供远程图形和游戏流媒体功能。容器使用EGL和VirtualGL直接访问GPU,无需X.Org X11服务器和额外主机配置。内置Wine等工具支持运行Windows应用和游戏。用户可选择Selkies-GStreamer WebRTC或KasmVNC WebSocket两种web界面。

DockerKDE Plasma DesktopNVIDIA GPUWebRTCKubernetesGithub开源项目

docker-nvidia-egl-desktop

KDE Plasma Desktop container designed for Kubernetes, supporting OpenGL EGL and GLX, Vulkan, and Wine/Proton for NVIDIA GPUs through WebRTC and HTML5, providing an open-source remote cloud/HPC graphics or game streaming platform. Directly accesses the GPU without an X.Org X11 Server using EGL with VirtualGL and Vulkan, not requiring /tmp/.X11-unix host sockets or host configuration.

Use docker-nvidia-glx-desktop for a KDE Plasma Desktop container with better performance, having fully optimized OpenGL and Vulkan for NVIDIA GPUs by spawning its own fully isolated X.Org X11 Server, also not using /tmp/.X11-unix host sockets.

Build

Discord

Please read Troubleshooting first, then use Discord or GitHub Discussions for support questions. Please only use Issues for technical inquiries or bug reports.

Usage

This container is composed fully of vendor-neutral applications and protocols except the NVIDIA userspace driver components, indicating that there is nothing stopping you from using this container with GPUs of other vendors including AMD and Intel. Use the container toolkit/runtime or Kubernetes device plugin of each respective vendor, or make sure that it provisions /dev/dri/card[n] and /dev/dri/renderD[128 + n] devices using --device=/dev/dri:rwm with sufficient host user permissions for the devices (sudo chmod -R -f 777 /dev/dri from the host), then set the environment variable SELKIES_ENCODER to values including vah264enc, x264enc, vp8enc, or vp9enc if using the Selkies-GStreamer WebRTC interface. However, this is not officially supported and issues may arise. This container also supports running without any GPUs with software fallback (set the environment variable SELKIES_ENCODER to values including x264enc, vp8enc, or vp9enc if using the Selkies-GStreamer WebRTC interface).

Container startup may take some time at first launch as it could automatically install NVIDIA driver libraries compatible with the host.

For Windows applications or games, Wine, Winetricks, Lutris, Heroic Launcher, PlayOnLinux, and q4wine are bundled by default. Comment out the section where it is installed within Dockerfile if the user wants containers without Wine.

The container requires host NVIDIA GPU driver versions of at least 450.80.02 and preferably 470.42.01 (the latest minor version in each major version), with the NVIDIA Container Toolkit to be also configured on the host for allocating GPUs. The latest minor versions (xx in 000.xx.00) are strongly encouraged. All Maxwell or later generation GPUs in the consumer, professional, or datacenter lineups should not have significant issues running this container, although the Selkies-GStreamer high-performance NVENC backend may not be available. Kepler GPUs are untested and likely does not support the NVENC backend, but can be mostly functional using fallback software acceleration.

The high-performance NVENC backend for the Selkies-GStreamer WebRTC interface is only supported in GPUs listed as supporting H.264 (AVCHD) under the NVENC - Encoding section of NVIDIA's Video Encode and Decode GPU Support Matrix. If your GPU is not listed as supporting H.264 (AVCHD), add the environment variable SELKIES_ENCODER to values including x264enc, vp8enc, or vp9enc in your container configuration for falling back to software acceleration, which also has a very good performance depending on your CPU.

There are two web interfaces that may be chosen in this container, the first being the default Selkies-GStreamer WebRTC HTML5 web interface (requires a TURN server or host networking for best performance), and the second being the fallback KasmVNC WebSocket HTML5 web interface. While the KasmVNC interface does not support audio forwarding, it can be useful for troubleshooting the Selkies-GStreamer WebRTC interface or using this container in constrained environments.

The KasmVNC interface can be enabled in place of Selkies-GStreamer by setting KASMVNC_ENABLE to true. KASMVNC_THREADS sets the number of threads KasmVNC should use for frame encoding, defaulting to all threads if not set. When using the KasmVNC interface, environment variables SELKIES_ENABLE_BASIC_AUTH, SELKIES_BASIC_AUTH_USER, SELKIES_BASIC_AUTH_PASSWORD, SELKIES_ENABLE_RESIZE, SELKIES_ENABLE_HTTPS, SELKIES_HTTPS_CERT, and SELKIES_HTTPS_KEY, used with Selkies-GStreamer, are also inherited. As with the Selkies-GStreamer WebRTC interface, the KasmVNC interface username and password will also be set to the environment variables SELKIES_BASIC_AUTH_USER and SELKIES_BASIC_AUTH_PASSWORD, also using ubuntu and the environment variable PASSWD by default if not set.

Running with Docker

1. Run the container with Docker, Podman, or other NVIDIA-supported container runtimes (NVIDIA Container Toolkit required):

docker run --name egl -it -d --gpus 1 --tmpfs /dev/shm:rw -e TZ=UTC -e DISPLAY_SIZEW=1920 -e DISPLAY_SIZEH=1080 -e DISPLAY_REFRESH=60 -e DISPLAY_DPI=96 -e DISPLAY_CDEPTH=24 -e PASSWD=mypasswd -e SELKIES_ENCODER=nvh264enc -e SELKIES_VIDEO_BITRATE=8000 -e SELKIES_FRAMERATE=60 -e SELKIES_AUDIO_BITRATE=128000 -e SELKIES_BASIC_AUTH_PASSWORD=mypasswd -p 8080:8080 ghcr.io/selkies-project/nvidia-egl-desktop:latest

Alternatively, use Docker Compose by editing the docker-compose.yml file:

# Start the container from the path containing docker-compose.yml docker compose up -d # Stop the container docker compose down

If the Selkies-GStreamer WebRTC HTML5 interface does not connect or is extremely slow, read Step 3 and the WebRTC and Firewall Issues section very carefully.

NOTE: The container tags available are latest and 24.04 for Ubuntu 24.04, 22.04 for Ubuntu 22.04, and 20.04 for Ubuntu 20.04. Persistent container tags are available in the form 24.04-20210101010101. Replace all instances of mypasswd with your desired password. SELKIES_BASIC_AUTH_PASSWORD will default to PASSWD if unspecified. The container must NOT be run in privileged mode.

For Apptainer/Singularity (requiring NVIDIA drivers):

# Customize paths export SINGULARITY_SELKIES_OVERLAY=~/my_mounting_point/nvidia-egl-desktop.sif export SINGULARITY_SELKIES_SCRATCH_HOME=~/nvidia-egl-desktop mkdir -pm755 "${SINGULARITY_SELKIES_SCRATCH_HOME}" # Change size of overlay storage singularity overlay create --sparse --size 1536 "${SINGULARITY_SELKIES_OVERLAY}" singularity instance run --overlay "${SINGULARITY_SELKIES_OVERLAY}" --nv --no-mount cwd --home "${SINGULARITY_SELKIES_SCRATCH_HOME}:/home/ubuntu" --env "TZ=UTC,DISPLAY_SIZEW=1920,DISPLAY_SIZEH=1080,DISPLAY_REFRESH=60,DISPLAY_DPI=96,DISPLAY_CDEPTH=24,PASSWD=mypasswd,SELKIES_ENCODER=nvh264enc,SELKIES_VIDEO_BITRATE=8000,SELKIES_FRAMERATE=60,SELKIES_AUDIO_BITRATE=128000,SELKIES_BASIC_AUTH_PASSWORD=mypasswd" docker://ghcr.io/selkies-project/nvidia-egl-desktop:latest egl

Change SELKIES_ENCODER to x264enc, vp8enc, or vp9enc when using the Selkies-GStreamer interface if you are using software fallback without allocated GPUs or your GPU does not support H.264 (AVCHD) under the NVENC - Encoding section in NVIDIA's Video Encode and Decode GPU Support Matrix.

The environment variable VGL_DISPLAY can also be passed to the container, but only do so after you understand what it implicates with VirtualGL, valid values being either egl[n], or /dev/dri/card[n] only when --device=/dev/dri:rwm was used for the container.

2. Connect to the web server with a browser on port 8080. You may also separately configure a reverse proxy to this port for external connectivity.

The default username is ubuntu for both the web authentication prompt and the container Linux username. The environment variable PASSWD (defaulting to mypasswd) is the password for the container Linux user account, and SELKIES_BASIC_AUTH_PASSWORD is the password for the HTML5 interface authentication prompt. If SELKIES_ENABLE_BASIC_AUTH is set to true for Selkies-GStreamer but SELKIES_BASIC_AUTH_PASSWORD is unspecified, the HTML5 interface password will default to PASSWD.

NOTE: Only one web browser can be connected at a time with the Selkies-GStreamer WebRTC interface. If the signaling connection works, but the WebRTC connection fails, read Step 3 and the WebRTC and Firewall Issues section.

Additional configurations and environment variables for the Selkies-GStreamer WebRTC HTML5 interface are listed in lines that start with parser.add_argument within the Selkies-GStreamer Main Script or selkies-gstreamer --help.

3. (Not Applicable for KasmVNC) Read carefully if the Selkies-GStreamer WebRTC HTML5 interface does not connect or is extremely slow.

A TURN server is required because you are self-hosting WebRTC, unlike commercial services using WebRTC.

Choose whether to use host networking, an internal TURN server, or an external TURN server.

  • Internal TURN Server:
<details> <summary>Open Section</summary>

There is an internal TURN server inside the container that may be used when an external TURN server or host networking is not available.

Add environment variables -e SELKIES_TURN_PROTOCOL=udp -e SELKIES_TURN_PORT=3478 -e TURN_MIN_PORT=65534 -e TURN_MAX_PORT=65535 (change the ports accordingly) with the docker run command (or uncomment the relevant docker-compose.yml sections), where the SELKIES_TURN_PORT should not be used by any other host process or container, and the TURN_MIN_PORT/TURN_MAX_PORT port range has to contain at least two ports also not used by any other host process or container.

Then, open the ports with the docker run arguments -p 8080:8080 -p 3478:3478 -p 3478:3478/udp -p 65534-65535:65534-65535 -p 65534-65535:65534-65535/udp (or uncomment the relevant docker-compose.yml sections) in addition to the web server port.

If UDP cannot be used, at the cost of higher latency and lower performance, omit the ports containing /udp and use the environment variable -e SELKIES_TURN_PROTOCOL=tcp.

All these ports must be exposed to the internet if you need access over the internet. If you need use TURN within a local network, add -e SELKIES_TURN_HOST=[YOUR_INTERNAL_IP] with YOUR_INTERNAL_IP to the internal hostname or IP of the local network.

</details>
  • Host Networking:
<details> <summary>Open Section</summary>

The Selkies-GStreamer WebRTC HTML5 interface will likely just start working if you open UDP and TCP ports 49152–65535 in your host server network and add --network host to the above docker run command, or network_mode: 'host' in docker-compose.yml. Note that running multiple desktop containers in one host under this configuration may be problematic and is not recommended. When deploying multiple containers, you must also pass a new DISPLAY environment variable such as -e DISPLAY=:22 into the container, that is not used with any other X11 server or container in the same host.

However, host networking may be restricted or not be desired because of security reasons or when deploying multiple desktop containers in one host. If not available, check if the container starts working after omitting --network host.

</details>
  • External TURN Server:
<details> <summary>Open Section</summary>

If having no TURN server does not work, you need an external TURN server. Read the WebRTC and Firewall Issues section and add the environment variables -e SELKIES_TURN_HOST=, -e SELKIES_TURN_PORT=, and pick one of -e SELKIES_TURN_SHARED_SECRET= or both -e SELKIES_TURN_USERNAME= and -e SELKIES_TURN_PASSWORD= environment variables to the docker run command based on your authentication method.

</details>

Running with Kubernetes

1. Create the Kubernetes Secret with your authentication password (change keys and values as adequate):

kubectl create secret generic my-pass --from-literal=my-pass=YOUR_PASSWORD

NOTE: Replace YOUR_PASSWORD with your desired password, and change the name my-pass to your preferred name of the Kubernetes secret with the egl.yml file changed accordingly as well. It is possible to skip the first step and directly provide the password with value: in egl.yml, but this exposes the password in plain text.

2. Create the pod after editing the egl.yml file to your needs, explanations are available in the file:

kubectl create -f egl.yml

If the Selkies-GStreamer WebRTC HTML5 interface does not connect or is extremely slow, read Step 4 and the WebRTC and Firewall Issues section very carefully.

NOTE: The container tags available are latest and 24.04 for Ubuntu 24.04, 22.04 for Ubuntu 22.04, and 20.04 for Ubuntu 20.04. Persistent container tags are available in the form 24.04-20210101010101. SELKIES_BASIC_AUTH_PASSWORD will default to PASSWD if unspecified. The container must NOT be run in privileged mode.

Change SELKIES_ENCODER to x264enc, vp8enc, or vp9enc when using the Selkies-GStreamer interface if you are using software fallback without allocated GPUs or your GPU does not support H.264 (AVCHD) under the NVENC - Encoding section in NVIDIA's Video Encode and Decode GPU Support Matrix.

**3. Connect to the web server spawned at port 8080. You may configure the ingress endpoint

编辑推荐精选

SimilarWeb流量提升

SimilarWeb流量提升

稳定高效的流量提升解决方案,助力品牌曝光

稳定高效的流量提升解决方案,助力品牌曝光

Sora2视频免费生成

Sora2视频免费生成

最新版Sora2模型免费使用,一键生成无水印视频

最新版Sora2模型免费使用,一键生成无水印视频

Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

AI助手热门AI工具AI创作AI辅助写作讯飞绘文内容运营个性化文章多平台分发
TRAE编程

TRAE编程

AI辅助编程,代码自动修复

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

热门AI工具生产力协作转型TraeAI IDE
商汤小浣熊

商汤小浣熊

最强AI数据分析助手

小浣熊家族Raccoon,您的AI智能助手,致力于通过先进的人工智能技术,为用户提供高效、便捷的智能服务。无论是日常咨询还是专业问题解答,小浣熊都能以快速、准确的响应满足您的需求,让您的生活更加智能便捷。

imini AI

imini AI

像人一样思考的AI智能体

imini 是一款超级AI智能体,能根据人类指令,自主思考、自主完成、并且交付结果的AI智能体。

Keevx

Keevx

AI数字人视频创作平台

Keevx 一款开箱即用的AI数字人视频创作平台,广泛适用于电商广告、企业培训与社媒宣传,让全球企业与个人创作者无需拍摄剪辑,就能快速生成多语言、高质量的专业视频。

即梦AI

即梦AI

一站式AI创作平台

提供 AI 驱动的图片、视频生成及数字人等功能,助力创意创作

扣子-AI办公

扣子-AI办公

AI办公助手,复杂任务高效处理

AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!

下拉加载更多