我正在尝试使用XDummy驱动程序在docker容器中运行X11服务器。但是,我在使用它时遇到了问题。预期目的是执行无头渲染。我可以使用Xvfb来使用它,但我需要RANDR支持,并且最终还需要GL支持。
Dockerfile:
FROM node:slim
RUN mkdir nodeapp \
&& apt-get update \
&& apt-get install -y xorg \
&& apt-get install -y xserver-xorg-video-dummy x11-apps
COPY App /nodeapp/
ENV DISPLAY :1
RUN cd nodeapp/ \
&& npm install \
&& Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile /nodeapp/xdummy.log -config /nodeapp/xorg.conf start :1 &
ENTRYPOINT [ "node", "/nodeapp/index.js" ]
xorg.conf文件是基本的Xdummy xorg.conf
然而,xserver没有启动,并且日志文件没有提供任何有用的东西,但我确信我在Dockerfile中设置Xorg时做错了什么,但是我找不到任何做类似事情的例子。
使这项工作的建议程序是什么?
答案 0 :(得分:8)
我订阅了#34;每个容器一件事" Docker的理念,所以我修改你的解决方案只做XDummy。它可以很容易地链接到另一个容器。
FROM debian:jessie ENV DEBIAN_FRONTEND noninteractive ENV DISPLAY :1 RUN apt-get update \ && apt-get -y install xserver-xorg-video-dummy x11-apps VOLUME /tmp/.X11-unix COPY xorg.conf /etc/X11/xorg.conf CMD ["/usr/bin/Xorg", "-noreset", "+extension", "GLX", "+extension", "RANDR", "+extension", "RENDER", "-logfile", "./xdummy.log", "-config", "/etc/X11/xorg.conf", ":1"]
然后访问,链接/tmp/.X11-unix
卷并在您的环境中设置DISPLAY=:1
。
答案 1 :(得分:5)
Managed to solve this, if anyone else is looking for a solution.
FROM node:slim
ENV DEBIAN_FRONTEND noninteractive
ENV DISPLAY :1
RUN mkdir nodeapp \
&& apt-get update \
&& apt-get -y install xserver-xorg-video-dummy x11-apps
COPY App /nodeapp/
RUN cd nodeapp/ \
&& npm install
ENTRYPOINT [ "node", "/nodeapp/index.js" ]
The problem was that apt-get was asking for keyboard config inside the docker container while installing, and that the dummy package provided all dependencies, so the regular xorg install was not needed.
The last issue was that I could not start Xorg and the nodeapp at the same time, but that was a easy fix. I already use node to manage services, so I moved the part starting Xorg into that.
var args = ["-noreset", "+extension", "GLX", "+extension", "RANDR", "+extension", "RENDER", "-logfile", "./xdummy.log", "-config", "/mplex-core/xorg.conf", ":1"];
this.proc = child_process.spawn("Xorg", args);