python - Python 脚本(PyQt5 GUI 组件)在 Docker 容器中运行且未连接到显示器
问题描述
我有一个 Python 脚本,它使用 PyQt5 GUI 根据用户查询数据库的输入设置不同的变量。我在 Docker 中有容器,一切都很好,但是当我用docker run surefire_loader
它运行容器时,会出现以下错误:QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' qt.qpa.screen: QXcbConnection: Could not connect to display Could not connect to any X display.
我的 Dockerfile 看起来像这样:
FROM python:3.6
ADD salesforce_extract_dict.py /
ADD config.py /
ADD requirements.txt /
RUN apt-get update && apt-get -qq install libgl1-mesa-glx
RUN pip install --trusted-host pypi.org --trusted-host
files.pythonhosted.org -r requirements.txt
CMD [ "python", "./salesforce_extract_dict.py" ]
我目前正在 Mac 上执行此操作,但我希望将其移至 Windows PC 进行生产 - 如果此信息有帮助的话。
可能是什么特殊问题,如何让 GUI 连接到本地机器的显示器?
解决方案
推荐阅读
- c# - AsEnumerable 返回值,过滤选项不返回
- php - 如何在 PHPExcel 中的命名范围上使用 foreach 循环
- docker - Scrapinghub/Splash - Aquarium 不适用于 docker-compose
- scala - 无法使用 scala 2.12.6 sbt Akka 下载 ZeroMQ 依赖项
- ios - JSON在swift中仅解析特定键
- ios - 关闭模态视图控制器 iOS 后无法切换到 TabBarController
- magento-1.9 - Magento 1.9 - 添加到购物车不适用于某些产品
- python - Python - 比较来自两个不同 csv 的两列中的相似值
- c# - 与较新版本的系统程序集绑定编译失败
- python - 如何使用 any() 测试两个数组是否重叠