jmtd → log → Some tools for working with Docker images
For developing complex, real-world Docker images, there are a number of tools that can make life easier.
The first thing to realise is that the Dockerfile
format is severely limited.
At work, we have eventually outgrown it and it has been replaced with a
structured YAML document that is processed into a Dockerfile
by a tool called
dogen. There are several
advantages to this, but I'll point out two: firstly, having data about the
image available in a structured format makes automatically deriving technical
documentation very easy. Secondly, some of the quirks of Dockerfile
s, such as
the ADD
command respecting the environment's umask, are worked around in the
dogen
tool.
We have a large suite of integration tests that we run against images to make sure that we haven't introduced regressions during their development. The core of this is the Container Testing Framework, which makes use of the Behave system.
Each command that is run in a Dockerfile
generates a new docker image layer.
In practice, this can mean a real-world image has a great number of layers
underneath it. Docker-dot-com have resisted introducing layer squashing into
their tools, but with both hard limits for layers in some of the storage
backends, and performance issues for most of the rest, this is a very real
issue. Marek Goldmann wrote a squashing tool
that we use to control the number of intermediate layers that are introduced by
our images.
Finally, even with tools like dogen and ctf, we would like to be able to have more sophisticated tools than shell scripts for configuring images, both at image build time and container run time. We want to do this without introducing extra dependencies inside the images which will not otherwise be used for their operation.
Ansible could be a solution for this, but there are practical issues with relying on it for runtime configuration in our situation. For that reason David Becvarik is designing and implementing Container Configuration Tool, or cct, a framework for performing configuration of containers written in Python.
Comments