目的是将一些GUI应用程序(主要是Kodi和Retroplayer)容器化并从主机启动它们。由于应用程序的性质,我需要音频支持和GPU加速,而不会出现延迟或额外的延迟。
我希望将整个桌面环境容器化,并在没有桌面环境的情况下使主机裸露,但不确定是否可行。
谁能指出我有关如何设置具有音频和英特尔gpu加速功能的LXC 2.0容器的文档方向。
我知道至少可以将gui应用容器化,并在主机桌面环境中启动它们,正如我所看到的例子中人们已经实现的那样。但是只能找到LXC 1.0的文档,而该文档当然不适用于2.0。
我还不确定如何在无头服务器中完全容器化显示管理器。
为了在容器中运行带有音频的gui应用程序,本教程对我有用。以下是步骤的摘要。请注意,我在Ubuntu 18.04.1。上使用LXD 3.5(快照)。
1.将以下内容保存到名为的文本文件中lxdguiprofile.txt
:
config:
environment.DISPLAY: :0
raw.idmap: both 1000 1000
user.user-data: |
#cloud-config
runcmd:
- 'sed -i "s/; enable-shm = yes/enable-shm = no/g" /etc/pulse/client.conf'
- 'echo export PULSE_SERVER=unix:/tmp/.pulse-native | tee --append /home/ubuntu/.profile'
packages:
- x11-apps
- mesa-utils
- pulseaudio
description: GUI LXD profile
devices:
PASocket:
path: /tmp/.pulse-native
source: /run/user/1000/pulse/native
type: disk
X0:
path: /tmp/.X11-unix/X0
source: /tmp/.X11-unix/X0
type: disk
mygpu:
type: gpu
name: gui
used_by:
2.将配置文件添加到您的LXD实例:
lxc profile create gui
cat lxdguiprofile.txt | lxc profile edit gui
3.将配置文件应用于容器:
lxc profile add "$container" gui
lxc restart "$container"
就是这样!要测试您的gui,请执行以下命令:
# Login to the ubuntu user in the container.
lxc exec "$container" -- su ubuntu -l
# This should show an animation of gears if all is well.
glxgears
# This command shows the audio setup info.
pactl info
请注意,在我的设置中,gui仅在ubuntu
容器内的默认用户中起作用。我不确定为什么,但是可以调整步骤以允许其他容器用户访问gui。我还遇到了运行硬件加速的应用程序(例如WineHQ或Steam)的麻烦。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句