如何从Docker容器中使用GUI应用程序?

问题描述

我的目标是使用主机Xserver从Docker容器运行任意GUI应用程序。

我尝试了http://wiki.ros.org/docker/Tutorials/GUI#The_simple_way-步骤1

我将使用docker run --gpus all --net=host -it -p "8888:8888" -v "/home/gillian/Documents/deeplearning/:/deeplearning/:" --env=DISPLAY=$DISPLAY --env=QT_X11_NO_MITSHM=1 --volume=/tmp/.X11-unix:/tmp/.X11-unix:rw pytorch

运行docker映像

但是,当我尝试从容器中运行xlogo或xclock时,它将始终返回错误Error: Can't open display: :0

在整夜试图修复它之后,我尝试使用--net=host作为docker run的参数。然后我可以运行xclock和xlogo,它将在我的屏幕上显示它们而没有任何问题。

为什么?

如何在不牺牲网络隔离性(--net = host)的情况下运行docker映像?

我正在运行Kubuntu 20.04

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...