Visualising LinuxKit builds with Python and GraphViz

For the first time in a while I found myself still working at 5AM; by choice!
Why? LinuxKit! as you may have guessed from previous posts, i’m a fan.

Why LinuxKit?

For me, as a low level OS/Ops backgrounded geek, it’s like a 2017 version of discovering “Linux From Scratch”, or even the first time pre-compiled binary packages appeared in Gentoo and saved you HOURS!

Exactly the bits of an OS you need for your solution, with community re-use of components, without re-inventing the wheel!

With higher order orchestrators such as Kubernetes needing less and less moving parts under them; The world of a more secure, more observable infrastructure, right down the stack is more within reach than ever!

Linuxkit is the perfect toolkit to build these lower level pieces.

The user or the builder?

I 100% believe that tooling such as LinuxKit will help millions run simpler infrastructure, potentially without knowing about it…

Like docker images on the hub now, the majority of users will benefit through re-use of the communities’ LinuxKit images.

I’d expect to even see whole open-source *Products* being LinuxKit based before the next DockerCon! If it’s an embedded system, or productized install. The user may never know the reason for the improved experience.

But what about the builders, the people working with the early LinuxKit code to build these images, to make these systems simpler, ephemeral and more composable…

It’s those people i’d like to ask;

Do you struggle to debug complex linuxkit manifests? Do you spend time digging back and forth between namespace looking at where your mounts are? Which Image got a directory from where? Or why new mounts aren’t showing up in other places you expect them?

It’s 100% possible it’s just me; but I really found visualising the build (and the mounts) helped me develop much quicker.

So, back to the 5AM… I hacked something together using Python and GraphViz to take in a LinuxKit mainifest (yaml), read the metadata labels from each of the docker images within and plot all of the mounts (along with image data) onto a GraphViz diagram.

LinuxKitVis output for one of my projects.

I’ve put the code on github here, and would love to get your feedback!

Find me on twitter as @mattdashj or in the DockerCommunity #Linuxkit room on slack! (TrXuk).

PS. To all those in Europe for DockerCon… have a WHALE of a time! (sorry).

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.