过程
docker desktop就不介绍了。在mac上使用orbstack作为替代。
linux下gui,主要是依赖于X11协议。而X11底层可以使用uds(本地通信,不走网络协议栈,使用本地路径作为目标地址),也可以使用tcp(支持跨系统通信,走网络协议栈,使用ip或域名作为目标地址)。
VeighNa发布v3.9.4 - 升级支持TDengine时序数据库3.0版本!中估计是使用的wsl作为演示的,x11底层使用uds。(windows与linux能通过uds通信?可能是受益于微软的wslg黑科技?)但是mac无法与docker容器(实际是运行在linux虚拟机器上)通过uds通信。但好在可以通过tcp通信。
By default, OrbStack doesn't provide an X server or Wayland compositor for running graphical apps. You can run XQuartz yourself and set the DISPLAY environment variable to connect to it over the network at host.docker.internal.
在mac上下载安装XQuartz,然后在X11偏好设置->安全性中,勾选“允许从网络客户端连接”。退出XQuartz再通过 xhost + && open -a XQuartz
打开。
docker run \
-e DISPLAY=host.docker.internal:0 \
veighna/veighna:3.9.4 \
bash -c 'wget https://raw.githubusercontent.com/vnpy/vnpy/refs/tags/3.9.4/examples/veighna_trader/run.py -O run.py && python3 ./run.py'
其他
之前运行
docker run \
-e DISPLAY=host.docker.internal:0 \
veighna/veighna:3.9.4 \
python3 -m veighna_station
遇到报错
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Sandboxing disabled by user.
WebEngineContext used before QtWebEngineCore::initialize() or OpenGL context creation failed.
QGLXContext: Failed to create dummy context
qt.webenginecontext:
GL Type: disabled
Surface Type: OpenGL
Surface Profile: NoProfile
Surface Version: 2.0
QSG RHI Backend: OpenGL
Using Supported QSG Backend: yes
Using Software Dynamic GL: no
Using Multithreaded OpenGL: no
Init Parameters:
* application-name __main__.pyc
* browser-subprocess-path /usr/local/lib/python3.10/dist-packages/PySide6/Qt/libexec/QtWebEngineProcess
* disable-features ConsolidatedMovementXY,InstalledApp,BackgroundFetch,WebOTP,WebPayments,WebUSB,PictureInPicture
* disable-gpu
* disable-speech-api
* enable-features NetworkServiceInProcess,TracingServiceInProcess
* enable-threaded-compositing
* in-process-gpu
* no-sandbox
* use-gl disabled
Failed to initialize graphics backend for OpenGL.
看样子是关于qt的WebEngineContext used before QtWebEngineCore::initialize() or OpenGL context creation failed.
,估计veighna_station
代码有问题,不过无伤大雅,改成运行examples/veighna_trader/run.py