x11 – LXC中的X和xdotool而不是KVM

到目前为止,我在KVM虚拟机(linux guest)中使用各种xautomation/xdotool脚本,以便让他们完成工作并让我不间断地工作.我使用的是VirtIO磁盘,但是大多数时候客户的性能仍然很慢.

我可以在LXC容器中执行相同操作,例如用docker

最佳答案
我不能对性能说些什么,但在研究这个时,我遇到了这个题为:can you run GUI apps in a docker?的SO Q& A,它显示了实现这一目标的3种方法.

>通过VNC运行AppX

此方法显示使用以下Dockerfile:

# Firefox over VNC
#
# VERSION               0.1
# DOCKER-VERSION        0.2

from    ubuntu:12.04
# make sure the package repository is up to date
run     echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
run     apt-get update

# Install vnc, xvfb in order to create a 'fake' display and firefox
run     apt-get install -y x11vnc xvfb firefox
run     mkdir /.vnc
# Setup a password
run     x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way to do it, but it does the trick)
run     bash -c 'echo "firefox" >> /.bashrc'

然后像这样运行Docker实例:

$docker run -p 5900 creack/firefox-vnc x11vnc -forever -usepw -create

>使用Docker Subuser

使用Subuser Docker,您可以在其中仅使用单个应用程序直接启动Docker VM,从而允许它们从物理主机对特定文件夹进行窄访问.

Subuser is meant to be easilly installed and in and of itself technically insignificant. It is just a wrapper around docker, nothing more.

Subuser launches docker containers with volumes shared between the host and the child container. That’s all.

这是video showing Subuser in action.
>通过SSH运行X11

最后一种技术显示了如何在其中运行X11 SSH服务的情况下设置Docker实例.然后,此设置允许任何X11应用程序通过SSH进行隧道传输.

The ssh is used to forward X11 and provide you encrypted data communication between the docker container and your local machine.

然后,此方法继续在本地设置Xpra Xephyr.

07002 + 07003 allows to display the applications running inside of the container such as Firefox, LibreOffice, xterm, etc. with recovery session capabilities. So, you can open your desktop any where without losing the status of your applications, even if the connection drops.

Xpra also uses a custom protocol that is self-tuning and relatively latency-insensitive, and thus is usable over worse links than standard X.

The applications can be rootless, so the client machine manages the windows that are displayed.

资料来源:DOCKER DESKTOP: YOUR DESKTOP OVER SSH RUNNING INSIDE OF A DOCKER CONTAINER

参考

> can you run GUI apps in a docker?

转载注明原文:x11 – LXC中的X和xdotool而不是KVM - 代码日志