user-interface - 在 Ubuntu 中的 Docker 中运行 GUI 程序

标签 user-interface ubuntu docker

我以前用这样的命令运行程序:

docker run -ti \
  --name wireshark \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $HOME/.Xauthority:/root/.Xauthority \
--privileged \
  -d ubuntu:17.10 /bin/bash

然后我可以使用我的 Ubuntu 系统的显示器运行 wireshark。 喜欢这个页面的例子:Running GUI App with docker

现在不行了。当我运行 wireshark 时出现此错误:

root@5ad127a8333a:/# wireshark 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
No protocol specified
QXcbConnection: Could not connect to display :0
Aborted (core dumped)

最佳答案

可以用

来解决这个问题

xhost +

但这样做是明智的

xhost -

在您不再使用此容器之后。

其实越限制

xhost +local:docker

够了

关于user-interface - 在 Ubuntu 中的 Docker 中运行 GUI 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47099483/

相关文章:

c# - 当我的方法在后台 WPF 中执行某些操作时,如何打开窗口或其他内容

当我单击调用线程 wait() 的停止按钮时,Java GUI 停止响应

linux - 革命 R : installation on debian jessie

ubuntu - Openstack 节点软件更新

docker - 卷和 docker-compose

macos - 我可以从boot2docker VM访问主机(OS X)文件系统吗?

java - 在java中将逻辑与GUI分离

ios - 有没有办法使用 SwiftUI 将可选对象绑定(bind)到 Toggle/Slider

shell - 如何在不给出完整路径的情况下调用命令?

postgresql - 错误 : unsatisfiable constraints when installing PostGIS on the Alpine Docker image