Testing Strategies for Docker Containers
Congratulations! You know how to build a Docker image and are able to compose multiple containers into a meaningful application. Hopefully, you’ve already created a Continuous Delivery pipeline and know how to push your newly created image into production or testing environment. Now, the question is - How do we test our Docker containers? There are multiple testing strategies we can apply. In this post, I’ll highlight them presenting benefits and drawbacks for each.
Docker Pattern: The Build Container
Let’s say that you’re developing a microservice in a compiled language or an interpreted language that requires some additional “build” steps to package and lint your application code. This is a useful docker pattern for the “build” container. In our project, we’re using Docker as our main deployment package: every microservice is delivered as a Docker image. Each microservice also has it’s own code repository (GitHub), and its own CI build job.
Docker Pattern: Deploy and update dockerized application on cluster
Docker is great technology that simplifies development and deployment of distributed applications. While Docker serves as a core technology, many issues remain to be solved. We find ourselves struggling with some of these issues. For example: How to create an elastic Docker cluster? How to deploy and connect multiple containers together? How to build CI/CD process? How to register and discover system services and more? For most, there are open source projects, or services available from the community as well as commercially, including from Docker, Inc.