Docker容器中如何运行一个带GUI的app?

Docker容器中如何运行一个带GUI的app?_第1张图片

问:


How can you run GUI apps in a docker container?

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


答:

You can simply install a vncserver along with firefox :)


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


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'

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

For docker version 1.3 or newer:

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

For docker before version 1.3:

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


原链接:

https://stackoverflow.com/questions/16296753/can-you-run-gui-apps-in-a-docker-container#



Docker容器中如何运行一个带GUI的app?_第2张图片


点击阅读原文,一起玩耍


你可能感兴趣的:(Docker容器中如何运行一个带GUI的app?)