运行 LXD 容器中的 Xvfb
Running Xvfb in LXD container
使用 Xvfb 在 LXD 容器 (ubuntu:16.04) 中 运行 GUI 应用程序很容易,并在容器中执行以下命令:
Xvfb -ac :99 -screen 0 1600x900x24 &
export DISPLAY=:99
firefox &
我的objective是在不登录的情况下执行上述命令,并在我启动容器时自动执行(lxc start)。
我试图在“/etc/init.d/my-script”中创建一个脚本,并使其可执行。但是没机会,没用(Link).
另外,当我尝试在主机内部执行 lxc exec <container_name> -- Xvfb -ac :99 -screen 0 1600x900x24 &
时,它会立即停止。
如果您能分享您的解决方案,我将不胜感激。
您想使用 "nohup" 运行 bash 命令,因此 bash 在后台继续 运行。
示例:lxc exec 容器 -- nohup bash -c "Xvfb -ac :99 -screen 0 1600x900x24 &"
参见:https://www.cyberciti.biz/tips/nohup-execute-commands-after-you-exit-from-a-shell-prompt.html
使用 Xvfb 在 LXD 容器 (ubuntu:16.04) 中 运行 GUI 应用程序很容易,并在容器中执行以下命令:
Xvfb -ac :99 -screen 0 1600x900x24 &
export DISPLAY=:99
firefox &
我的objective是在不登录的情况下执行上述命令,并在我启动容器时自动执行(lxc start)。
我试图在“/etc/init.d/my-script”中创建一个脚本,并使其可执行。但是没机会,没用(Link).
另外,当我尝试在主机内部执行 lxc exec <container_name> -- Xvfb -ac :99 -screen 0 1600x900x24 &
时,它会立即停止。
如果您能分享您的解决方案,我将不胜感激。
您想使用 "nohup" 运行 bash 命令,因此 bash 在后台继续 运行。
示例:lxc exec 容器 -- nohup bash -c "Xvfb -ac :99 -screen 0 1600x900x24 &"
参见:https://www.cyberciti.biz/tips/nohup-execute-commands-after-you-exit-from-a-shell-prompt.html