I feel pondering hard Questions leads to more knowledge than just seeking answers. Here I'll try to strike a balance between then Questions I've had and the potentially correct Solutions to match.

Saturday, February 15, 2014

Docker and X: A match made with filesystems

Docker has been generating a lot of hype recently, and for good reason!  A lightweight alternative to VMs which can be version controlled and sent strait from development to production!  What's not to love?

Running a web servers are fairly strait forward applications and generally well battle tested.  Something that isn't stable and generally fought with quirks is the X desktop.  So lets look into whether Docker can support the mess that is X.

When attempting to install an X desktop in a Docker container there is an issue, Docker doesn't have perfect access to all the core system devices which X needs:
Creating fuse device...
mknod: `fuse-': Operation not permitted
makedev fuse c 10 229 root root 0660: failed
chown: cannot access `/dev/fuse': No such file or directory
dpkg: error processing fuse (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 fuse
E: Sub-process /usr/bin/dpkg returned an error code (1)


This error is thrown whenever attempting to install xfce or lxde.  Consequently I did some googling to skirt the issue of installing full X on Docker and couldn't come up with much.  Using X desktops and Docker is obviously not it's main use case, so it's somewhat expected.  However I decided to search for what I was trying to accomplish, running Selenium in a Docker container; this has been done, and quite nicely.  

Vvoyer's Docker Selenium Container
The solution is to use Xvfb, which completely bypasses the need for a full graphical stack and allows selenium to run quietly in buffers.  So assuming you're confident in your selenium procedures, everything should proceed as usual.

Vincent Voyer made a nice write up of design and usage of the container which can be found on his blog: Easy-selenium-chrome-Firefox-installs-with-Docker

There are a few things I would change in regards to using Chromium instead of Chrome, but otherwise it's a solid solution and baseline for working with X in Docker containers.  Hopefully I'll be able to dig deeper into the /dev/fuse error and understand what the real problem is.


No comments:

Post a Comment