我正在尝试为Tauri开发设置VS代码开发容器环境。我使用X转发在容器的主机系统上显示应用程序。当我试图通过yarn tauri dev启动应用程序时,主机的X11服务器会显示应用程序,但会显示一个黑色的屏幕。对于容器,我收到以下警告和错误:
(process:3623): Gtk-WARNING **: 20:01:34.585: Locale not supported by C library.
Using the fallback 'C' locale.
event - compiled client and server successfully in 9.3s (176 modules)
(process:3665): Gtk-WARNING **: 20:01:40.390: Locale not supported by C library.
Using the fallback 'C' locale.
(WebKitWebProcess:3665): Gdk-ERROR **: 20:01:42.784: The program 'WebKitWebProcess' received an X Window System error.
This probably reflects a bug in the program.
The error was 'GLXBadFBConfig'.
(Details: serial 173 error_code 163 request_code 149 (GLX) minor_code 21)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)这是我正在使用的Dockerfile
#FROM debian:bullseye
FROM nvidia/opengl:1.0-glvnd-runtime-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive
# install dependencies from package manager
RUN apt update && \
apt install -y libwebkit2gtk-4.0-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
# install rust
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y
# install nodejs, npm & yarn
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
RUN npm install -g yarn
# create 'dev' user
RUN mkdir /home/dev
RUN useradd -u 1000 dev && chown -R dev /home/dev这是devcontainer.json
{
"name": "Tauri Dev Environment",
"dockerFile": "Dockerfile",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"rust-lang.rust",
"be5invis.toml"
],
"remoteEnv": {
"DISPLAY": "host.docker.internal:0"
},
"runArgs": ["--gpus=all"],
"workspaceMount": "source=${localWorkspaceFolder},target=/home/dev/workspace/${localWorkspaceFolderBasename},type=bind",
"workspaceFolder": "/home/dev/workspace/${localWorkspaceFolderBasename}",
}正如您在Dockerfile中所看到的,首先我尝试使用Debian基映像。然后,我认为这个问题可以通过访问我的系统的GPU通过Nvidia映像和相应的配置来解决。然而,这两次尝试都导致了同样的结果。值得注意的是,通过“基于Debian的”映像,我能够成功地从容器中转发浏览器UI。
更新:问题仅在我以“多窗口”模式运行主机的X11服务器时才存在。当我在“全屏”或“单一窗口”模式下运行它时,Tauri应用程序将被正确显示。这也适用于没有GPU访问的简单Debian基本映像。下面的图像显示了显示设置的工作和不工作。有人知道为什么它不能在“多窗口”模式下工作吗?

发布于 2022-10-31 10:02:05
这似乎是X11服务器的一个问题。我以前用过VcXsrv。当我使用Xming时,"Multiple“选项工作正常。我想再次强调,Nvidia基本图像和GPU访问是不需要的。
https://stackoverflow.com/questions/74256433
复制相似问题