Lightdm在Docker容器中给出“无法获得D-bus连接”

所以我一直在试图运行一个docker容器,在那里我需要运行一个依赖于lightdm的应用程序。

我的应用程序不能正确检查日志我发现它试图启动X11服务器,但失败。 清理互联网我发现X11取决于lightdm。

我试过service lightdm start但是给了我

  * Starting X display manager lightdm [+0.00s] DEBUG: Logging to /var/log/lightdm/lightdm.log [+0.00s] DEBUG: Starting Light Display Manager 1.18.3, UID=0 PID=15447 [+0.00s] DEBUG: Loading configuration dirs from /usr/share/lightdm/lightdm.conf.d [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-disable-log-backup.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-greeter-wrapper.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf [+0.00s] DEBUG: Loading configuration from /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf [+0.00s] DEBUG: Loading configuration dirs from /usr/local/share/lightdm/lightdm.conf.d [+0.00s] DEBUG: Loading configuration dirs from /etc/xdg/lightdm/lightdm.conf.d [+0.00s] DEBUG: Loading configuration from /etc/lightdm/lightdm.conf [+0.00s] DEBUG: Using D-Bus name org.freedesktop.DisplayManager [+0.01s] DEBUG: Registered seat module xlocal [+0.01s] DEBUG: Registered seat module xremote [+0.01s] DEBUG: Registered seat module unity [+0.01s] WARNING: Failed to get system bus: Could not connect: No such file or directory [+0.01s] DEBUG: Adding default seat [+0.01s] DEBUG: Seat seat0: Loading properties from config section Seat:* [+0.01s] DEBUG: Seat seat0: Starting [+0.01s] DEBUG: Seat seat0: Creating greeter session [+0.01s] DEBUG: Seat seat0: Creating display server of type x [+0.01s] DEBUG: Using VT 7 [+0.01s] DEBUG: Seat seat0: Starting local X display on VT 7 [+0.01s] DEBUG: DisplayServer x-0: Logging to /var/log/lightdm/x-0.log [+0.01s] DEBUG: DisplayServer x-0: Writing X server authority to /var/run/lightdm/root/:0 [+0.01s] DEBUG: DisplayServer x-0: Launching X Server [+0.01s] DEBUG: Launching process 15452: /usr/bin/X -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch [+0.01s] DEBUG: DisplayServer x-0: Waiting for ready signal from X server :0 Failed to get D-Bus connection 

值得注意的是,即使安装了xinit当我尝试运行startx时,也command not found

来到我的docker容器的细节:我从我的图像创build一个容器,并在后台运行它使用:

 sudo docker run -d -ti --rm -e DISPLAY=$DISPLAY -v /tmp.X11-unix:/tmp/.X11-unix agent-ad /bin/bash 

然后我使用正在运行的容器

 sudo docker exec -it --privileged <Container ID> /bin/bash 

正如预期的运行ps -eaf我可以看到两个bash shell运行。 我启动我的应用程序(手动),无法启动X11服务器,这可能是因为这些服务没有运行。 这是我遇到lightdm ,这给了我上述错误。

请让我知道这可能是什么原因,如果我需要启动一些其他服务来调出X11服务器。