在Ubuntu中的Docker中运行GUI程序

时间:2017-11-03 15:37:56

标签: 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)

1 个答案:

答案 0 :(得分:4)

可以通过

解决这个问题

xhost +

然后明智的做法

xhost -

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

实际上限制性更强

xhost +local:docker

就够了

相关问题