首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从docker运行GUI应用程序,QStandardPaths: XDG_RUNTIME_DIR未设置,默认为‘/tmp/运行时-root’

从docker运行GUI应用程序,QStandardPaths: XDG_RUNTIME_DIR未设置,默认为‘/tmp/运行时-root’
EN

Stack Overflow用户
提问于 2020-03-20 11:51:31
回答 2查看 3.7K关注 0票数 2

我对Docker相当陌生(昨天了解到它,发现它很有趣),而且对它完全没有技巧,所以请尽量使您的回答尽可能友好。我运行了一个ubuntu映像,并试图在其中安装和运行wireshark (基于GUI的数据包捕获器),但是在运行时我得到了以下错误:

代码语言:javascript
复制
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)

我用:

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软件包,但我不知道该做哪一件或是否正确的事情。

EN

回答 2

Stack Overflow用户

发布于 2020-11-16 15:48:04

编写完xhost +x之后,如果您在docker命令中添加了--privileged,那么它应该可以工作。

代码语言:javascript
复制
sudo docker run -it \
   --privileged \
   -e DISPLAY=$DISPLAY \
   -v $HOME/.Xauthority:/root/.Xauthority \
    <imageId>

然而,使用xhost +x--privileged并不安全。不建议在生产环境中使用它们,因为它们公开内核和主机的硬件资源。

票数 2
EN

Stack Overflow用户

发布于 2022-07-17 12:42:41

面对这个问题,他遵循了“Doğuş”和“Casey Jones”作为参考,这几乎是有帮助的。仍然面临着没有将主机设置为该机器的问题。

因此,我更新的命令如下

docker运行-it --特权-net=主机-e DISPLAY=$DISPLAY -v $HOME/..Xauthority:/root/..Xauthority /bin/bash

其中IMAGE_ID是您的码头形象id。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60773578

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档