确定用于 Docker 中屏幕共享的显示系统和合成器

问题描述

我正在尝试在不使用 x11docker 的情况下模拟 x11docker 所做的事情,并且有一些有用的示例可以为 WaylandX 做到这一点。

我让这个示例在 Ubuntu 18.04 中运行:

Dockerfile

FROM ubuntu:18.04
RUN apt-get update && apt-get install -y chromium-browser
CMD ["/usr/bin/chromium-browser","--no-sandBox","--start-fullscreen","https://duckduckgo.com"]

docker-compose.x11.yml

version: "3"

services:
  app:
    build:
      context: .
      network: host
    environment:
      - disPLAY=${disPLAY}
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix

然后我就跑了

docker-compose up --build

我得到了一个指向duckduckgo的chrome浏览器。

但是,我现在已经更新到 20.04,我无法再使用任何一个示例来使用它。

上面的示例产生以下错误

$ docker-compose -f docker-compose.x11.yml up --build
Building app
Sending build context to Docker daemon   5.12kB
Step 1/3 : FROM ubuntu:18.04
 ---> 81bcf752ac3d
Step 2/3 : RUN apt-get update && apt-get install -y chromium-browser
 ---> Using cache
 ---> 2d81deee9198
Step 3/3 : CMD ["/usr/bin/chromium-browser","https://duckduckgo.com"]
 ---> Using cache
 ---> 50d1aa785f78
Successfully built 50d1aa785f78
Successfully tagged asdf_app:latest
Starting asdf_app_1 ... done
Attaching to asdf_app_1
app_1  | No protocol specified
app_1  | [1:1:0709/125654.379970:ERROR:browser_main_loop.cc(1402)] Unable to open X display.
asdf_app_1 exited with code 1

所以我创建了一个改编的 Wayland compose,因为我知道这是 20 的认值。

docker-compose.wayland.yml

version: "3"

services:
  app:
    build:
      context: .
      network: host
    environment:
      - WAYLAND_disPLAY=${WAYLAND_disPLAY}
      - disPLAY=${disPLAY}
    volumes:
      - ${XDG_RUNTIME_DIR}/${WAYLAND_disPLAY}:/tmp/${WAYLAND_disPLAY}
      - /tmp/.X11-unix:/tmp/.X11-unix

这会产生相同的错误“无法打开 X 显示)。我的主机系统没有 WAYLAND_disPLAY 的任何值,但有 XDG_RUNTIME_DIR 的值。 XDG_SESSION_TYPE 的值为 x11disPLAY 设置为 :0

那么我在这里实际运行的是什么,我如何知道?根据我的发现,我似乎在运行 Wayland:

$ cat /etc/gdm3/custom.conf
# GDM configuration storage
#
# See /usr/share/gdm/gdm.schemas for a list of available options.

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=johan

# Uncomment the line below to force the login screen to use Xorg
#WaylandEnable=false

# Enabling automatic login

# Enabling timed login
#  TimedLoginEnable = true
#  TimedLogin = user1
#  TimedLoginDelay = 10

[security]

[xdmcp]

[chooser]

[debug]
# Uncomment the line below to turn on debugging
# More verbose logs
# Additionally lets the X server dump core if it crashes
#Enable=true

那么为什么 XDG_SESSION_TYPE 说的是 x11?

我需要什么值组合才能让我与 Docker 容器共享我的屏幕?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)