在Ubuntu中的Docker中运行GUI程序 [英] Run GUI programs in Docker in Ubuntu
本文介绍了在Ubuntu中的Docker中运行GUI程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我以前使用以下命令运行程序:
I used to run programs with commands like this:
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。
类似于此页面的示例:正在运行的GUI带有docker
then I could run wireshark using my Ubuntu's system's display. Like this page's example: Running GUI App with docker
的应用程序现在不起作用。当我运行wireshark时,出现以下错误:
Now it is not working. When I run wireshark I get this error:
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 +
但是这样做是明智的选择
but it would then be wise to do
xhost-
在您不再使用此容器之后。
after you no longer use this container.
实际上限制更严格
xhost + local:docker
足够
这篇关于在Ubuntu中的Docker中运行GUI程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文