The regular Boot2Docker ISO has a command line environment (CLI). But it can also be useful to have a graphical environment (GUI)...
The distribution on which it is based, Tiny Core Linux, has two main images available: "Core" and "TinyCore" (with Xorg, and a desktop)
This makes it possible to produce an alternative boot2docker-x11.iso, that starts a local X11 server - after first booting into Docker as usual:
You can mount the X11 socket from this server in your Docker machine, to enable your containers to have a graphical interface (a $DISPLAY):
docker run -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix ...
Since this only exposes the machine X11 server, it is still "safe" unlike exposing your regular X11 server socket to the container.
See https://github.com/mviereck/x11docker for more details on that.
This particular image also enables X11 forwarding, so you can use that instead if you prefer and have the possibility (are running X).
docker-machine ssh default -X
You build this ISO, by using the normal ISO build environment as a base. Note that this requires a couple of GB of memory and disk...
docker build -f Dockerfile.x11 -t boot2docker-x11 .
docker run --rm boot2docker-x11 > boot2docker-x11.iso
You can use the provided Apps icon, to download and install more desktop applications. They will load into RAM, just like the rest.
As usual, if you want anything to survive a restart you will need to use
the /var/lib/boot2docker
mount - instead of the temporary filesystem.
Thanks to Boot2Docker, and Tiny Core Linux!
Written by Anders Björklund (@afbjorklund)
Where can I find a
Dockerfile.x11
to use for these instructions?