Sign inSign up

patrickmerlot/gui-with-xvfb

By patrickmerlot

•Updated over 11 years ago

Demo running a software with a GUI using Xvfb

Image
1

995

patrickmerlot/gui-with-xvfb repository overview

⁠Graphical Software within a Docker container

This project is a demo for running a program with a GUI within a Docker container.

Docker normally doesn't handle the "X server", as for most "headless servers", and therefore fails at opening many GUI programs.

The demo is inspired from https://linuxmeerkat.wordpress.com/2014/10/17/running-a-gui-application-in-a-docker-container/⁠, and consists of a python script (firefox.py⁠) opening Firefox and fetching the HTML source of a webpage.

⁠Results

You can try the script in your terminal and check what it does:

$ python firefox.py

You should see Firefox opening the webpage, and when finished, printing HTML to your terminal.

Now running within Docker, you can see that:

$ sudo docker run -ti patrickmerlot/xvfb_demo
  • the page is loaded,
  • the HTML source printed,
  • but the Firefox GUI doesn't appear! At least the script can proceed without crashing.

⁠Commands

To rebuild the Docker image:

$ sudo docker build --rm -t patrickmerlot/xvfb_demo .

To run the app within Docker:

$ sudo docker run -ti patrickmerlot/xvfb_demo

Tag summary

Content type

Image

Digest

sha256:bb127aeb0…

Size

-

Last updated

over 11 years ago

docker pull patrickmerlot/gui-with-xvfb