Can you run GUI applications in a Docker container?

前端 未结 22 2743
南旧
南旧 2020-11-22 06:12

How can you run GUI applications in a Docker container?

Are there any images that set up vncserver or something so that you can - for example - add an e

22条回答
  •  温柔的废话
    2020-11-22 06:49

    The solution given at http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/ does seem to be an easy way of starting GUI applications from inside the containers ( I tried for firefox over ubuntu 14.04) but I found that a small additional change is required to the solution posted by the author.

    Specifically, for running the container, the author has mentioned:

        docker run -ti --rm \
        -e DISPLAY=$DISPLAY \
        -v /tmp/.X11-unix:/tmp/.X11-unix \
        firefox
    

    But I found that (based on a particular comment on the same site) that two additional options

        -v $HOME/.Xauthority:$HOME/.Xauthority
    

    and

        -net=host 
    

    need to be specified while running the container for firefox to work properly:

        docker run -ti --rm \
        -e DISPLAY=$DISPLAY \
        -v /tmp/.X11-unix:/tmp/.X11-unix \
        -v $HOME/.Xauthority:$HOME/.Xauthority \
        -net=host \
        firefox
    

    I have created a docker image with the information on that page and these additional findings: https://hub.docker.com/r/amanral/ubuntu-firefox/

提交回复
热议问题