在 docker 中禁止显示

Suppressing display in docker

我有一张 docker 图片,其中安装了医疗数据分析应用程序。该应用程序适用于图形用户界面和控制台。通常,在我的 linux 中,我 运行 来自终端的应用程序

./dsi_studio --action=trk ...

并且运行起来相当流畅。如果你点击这个应用程序,它会尝试打开一个 GUI。当我尝试在 docker 图像中使用它时,它会尝试在任何情况下连接到显示器(即使我 运行 如终端所示)。而且,当然,由于我没有为从 docker 显示 GUI 进行任何设置,我收到以下错误,指出它找不到要连接的显示器。

qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

我不知道为什么应用程序在 运行 在终端中尝试打开显示,因为它没有在我的 linux 中打开 GUI。我只是想以某种方式抑制这个警告,就好像有一个假的显示一样。我不想将我的显示器连接到 docker 图像,因为该图像将在 HPC 中批量 运行。

那么,我该怎么做呢?

您可能应该导出 DISPLAY 环境变量以指向您的 linux 终端。 只是为了测试,运行

xhost +

在您的 linux 终端中添加

-e DISPLAY=:0.0

到您的 docker 命令行