从docker运行GUI应用程序,QStandardPath:XDG#u RUNTIME#u DIR未设置,默认为'/tmp/runtime root';

从docker运行GUI应用程序,QStandardPath:XDG#u RUNTIME#u DIR未设置,默认为'/tmp/runtime root';,docker,Docker,我是Docker的新手(昨天才知道,觉得很有趣),完全没有技巧,所以请尽量让你的回答更友好。 我运行了一个ubuntu映像,并试图在其中安装和运行wireshark(基于GUI的数据包捕获器),但在运行时,我遇到了以下错误: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' dbus[2537]: The last reference on a connection was dropped wit

我是Docker的新手(昨天才知道,觉得很有趣),完全没有技巧,所以请尽量让你的回答更友好。 我运行了一个ubuntu映像,并试图在其中安装和运行wireshark(基于GUI的数据包捕获器),但在运行时,我遇到了以下错误:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
dbus[2537]: The last reference on a connection was dropped without closing the connection. This is a bug in an application. See dbus_connection_unref() documentation for details.
Most likely, the application was supposed to call dbus_connection_close(), since this is a private connection.
  D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)
我用以下材料制作docker容器:

sudo-docker-run--name ubuntu-v/home/anmol/Projects/docker/ubuntu/:/home-it--volume=“$home/.Xauthority:/root/.Xauthority:rw”--env=“DISPLAY”--net=host ubuntu

此外,我还尝试过:

xhost+local:docker

这不起作用,所以我试着:

xhost+

这也不起作用,我不断地犯同样的错误


我有一种感觉,我应该在我的容器中安装一些x11软件包,但我不知道该安装哪一个,也不知道这样做是否正确。

在编写
xhost+x
后,如果在docker命令中添加
--privileged
,它应该可以工作

sudo docker run -it \
   --privileged \
   -e DISPLAY=$DISPLAY \
   -v $HOME/.Xauthority:/root/.Xauthority \
    <imageId>
sudo docker run-it\
--特权的\
-e显示=$DISPLAY\
-v$HOME/.Xauthority:/root/.Xauthority\
但是,使用
xhost+x
--privileged
是不安全的。不建议在生产环境中使用它们,因为它们公开主机的内核和硬件资源