1. get and copy the xauth cookie:
xauth list
2. start ubuntu container
docker run -it --rm --name=firefox --net=host -e DISPLAY -v /tmp/.X11-unix ubuntu:16.04 bash
3. inside container, install some things:
apt-get update
apt-get install firefox xauth
4. paste xauth cookie:
xauth add PASTE_COOKIE_HERE
5. run firefox:
firefox
6. at this point,
on host, commit to use later:
docker commit firefox firefox:0.1
7. you can run firefox later:
docker run -it --rm --name=firefox --net=host -e DISPLAY -v /tmp/.X11-unix ubuntu:16.04 firefox
Source:
https://www.youtube.com/watch?v=RDg6TRwiPtg