你可以在Docker容器中运行GUI应用程序吗? [英] Can you run GUI apps in a docker container?

查看:411
本文介绍了你可以在Docker容器中运行GUI应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can you run GUI apps in a docker container?

是否有任何图像设置 vncserver 或某些东西,以便您可以 - 例如 - 添加一个额外的速度沙箱围绕说Firefox?

Are there any images that set up vncserver or something so that you can - for example - add an extra speedbump sandbox around say Firefox?

推荐答案

您可以直接安装vncserver和firefox:)

You can simply install a vncserver along with firefox :)

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

I pushed an image vnc/firefox here: docker pull creack/firefox-vnc

该图像是用这个Dockerfile制作的: p>

The image has been made with this 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

This will create a docker container running vnc with the password 1234:

对于docker 1.3或更新版本:

For docker version 1.3 or newer:

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

1.3:

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

这篇关于你可以在Docker容器中运行GUI应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆