linux - 你可以在 Linux Docker 容器中运行 GUI 应用程序吗?

标签 linux docker x11 sandbox vnc

如何在 Linux 中运行 GUI 应用程序Docker容器?

是否有任何图像可以设置 vncserver 或其他东西,以便您可以 - 例如 - 在 Firefox 周围添加一个额外的加速沙箱?

最佳答案

你可以简单地安装一个 vncserver 和 Firefox :)

我在这里推送了一个镜像 vnc/firefox:docker pull creack/firefox-vnc

镜像是用这个 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'

这将创建一个运行 VNC 的 Docker 容器,密码为 1234:

对于 Docker 版本 18 或更高版本:

docker run -p 5900:5900 -e HOME=/ creack/firefox-vnc x11vnc -forever -usepw -create

对于 Docker 1.3 或更高版本:

docker run -p 5900 -e HOME=/ creack/firefox-vnc x11vnc -forever -usepw -create

对于 1.3 版之前的 Docker:

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

关于linux - 你可以在 Linux Docker 容器中运行 GUI 应用程序吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16296753/

相关文章:

linux - Apache 2.4 命中 rlimit_nproc : hidden processes?

linux - 让父进程等到子进程调用 exec

linux - 可以使 shell 与 --command 选项一起交互式运行

docker - 这对 docker 来说正常吗?

c++ - 多平台环境中的字体

c++ - X11 窗口不放入 QWidget 以嵌入 Qt 应用程序

c++ - 如何允许工作线程更新 X11 窗口?

python - 使用 Bash 脚本从文件夹名称中删除前 4 个字母

docker - 来自openshift命名空间的Openshift特权容器访问服务

docker - docker :错误:无法删除一个或多个图像