Member-only story

Docker Image Testing With Container Structure Tests

Aaron Berry
Level Up Coding
Published in
5 min readSep 18, 2022

Containers have become a leading technology for defining and consistently running our software, helping reduce the dreaded “, but it works on my system” problem when trying to debug an issue or run an application. So by wrapping our software and its runtime dependencies into a container image, we create an artefact that you can test to guarantee it works as expected through the different stages of the testing lifecycle. Since we put these testing expectations onto the software we are creating, why do we not do the same level of testing to the container runtime it is using?

Depending on your application’s runtime environment, you may be required to expose specific labels, environment variables or build arguments on your images. Still, you cannot guarantee that the container image contract to the consumers of that image is working as required when your final built image. Can you ensure the tools are installed correctly with the current containers you are building? Or that your container starts as expected when you pass in an argument?

In this article, we will cover how with GoogleContainerTools/container-structure-test, you can implement testing on your built container images to a defined container specification to assure that they meet that specification. By doing so, you can guarantee your container runtime meets its requirements…

--

--

Written by Aaron Berry

Software Engineer working in Data Engineer and DevOps. Tinkering with anything automation, containers and servers in the cloud.

No responses yet

What are your thoughts?