Sometimes, I should rebuild docker containers, however, I don’t know how the container should work. The sentence “The resulting image should behave like the current one” sounds clear, however, it is not a measurable goal. From my point of view, we have to write “tests” for our containers. I believe that infrastructure is code & we must use the same philosophy for infrastructure as for software development, i.e, testing
One of the interesting ways is to use ansible-container & molecule:
what do you think about it? “build container via ansible-container” sounds like a cleaner way than the bash stuff that has accumulated over the years. However, we should always consider the advantages that it brings:
So, the main point is cover by tests existing containers, not just rewrite to ansible-containers for fun. There is 2 framework already exist testkitchen and molecule framework. Everyone can use it. Also, you can create & support your own framework.
From my point of view the framework means:
Where are a lot of tools for that: testinfra, inspec, serverspec. I’d like to share some examples of tests:
You can read about coherent issue about ansible roles testing