A bad bargain - fewer builds, greater uncertainty

In  my last post, I described Syncing from GitLab to Docker Host Volume to ensure that the correct set of configuration files were read on startup.

What I didn't explain was that I don't actually recommend this approach.

Did it work?

Yes, it did.

Yes, we were able to control and distribute the configuration in such a way that we could track changes and say what configuration had been used to start each container.

So what was wrong?

In a word, complexity - we made life unnecessarily complicated for ourselves.  It would have been far simpler to have built a new image for each change to the set of configuration files, and then published the image in a repository (public or private).

What we were saving ourselves with the syncing approach was the effort of building a new image with each change.  But building a new image isn't that much effort, and can be automated in any case.

Fewer images doesn't give any significant saving in terms of storage either.  With multiple versions of the same image the additional storage used is only what you need to store the delta - in this case the differences between the files in the config directory.

The advantage of building the image each time is that you have much greater certainty of what configuration a running container is using, since it is baked into the container.

If it were me, I'd much rather have a repository containing more images, with the configuration as fixed as possible.  Any configuration information that does need to be defined at container startup should be done through environment variables, and written to the log straight away.

Fundamentally we traded off certainty in configuration for "less effort" building containers.  Except the "less effort" approach actually involved additional effort to set up the syncing approach, and means a more complicated system to maintain.

So why did we use the syncing approach?  Because that's what the customer had set their hearts on.

And yes, it worked - in a POC.

I'll be very interested to see if they keep this model in production.

Comments

Popular posts from this blog

Wot no FDK?

The Case of the Vanishing Dockerfile

Honey I Shrunk The Container