Docker无法连接到X服务器 [英] Docker cannot connect to X server

查看:486
本文介绍了Docker无法连接到X服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为opencv和面部识别创建了一个docker镜像,以简化设置过程。

I have created a docker image for opencv and facial reckognition to simplify the setup process.

但是accept.py脚本需要X Server来显示镜像结果。这是我到目前为止所做的事情:

But the recognize.py script needs X Server to show the image result. Here is what I have done so far:

sudo docker run -t -d --name opencv opencv:latest
sudo docker exec -it opencv bash /extract-embeddings.sh
sudo docker exec -it opencv bash /train-model.sh

到目前为止一切都很好。最后一步是将结果显示在图像中的实际比较。

All is fine so far. The last step is the actual comparison that displays the result in an image.

sudo docker exec -it opencv bash /face-recognition.sh

它给出输出:

[INFO] loading face detector...
[INFO] loading face recognizer...
No protocol specified
: cannot connect to X server :0

我尝试使用以下命令运行容器:

I have tried running the container with the following command:

sudo docker run -t -d --name opencv -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix opencv:latest

但这没有帮助。

推荐答案

xauth似乎是查看图像的问题。
详细信息在在Docker容器中运行GUI应用程序?

It looks like the xauth is the issue for viewing of the image. The details are at Can you run GUI applications in a Docker container?

这篇关于Docker无法连接到X服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆