Section 2: Designing and Operating a Single Service – Creating a Docker Container
This section follows the creation of a single microservice across three chapters. It starts by presenting an individual REST service implemented in Python, continues with all the requisite steps to implement the service as a self-contained Docker container, and creates a pipeline to ensure that the service always complies with high quality standards.
The first chapter of this section describes the implementation of a single service, following the example presented in the first section. It describes the API interface to be implemented and it uses Python to generate a full-fledged microservice, using tools such as Flask and SQLAlchemy to improve the ease of development. The service includes a testing strategy.
The second chapter of this section shows how to encapsulate the microservice in a Docker container so that the code can be executed immutably through the software life cycle. Basic Docker usage, such as building and running containers, using environment variables, and how to execute testing, is introduced. The process of sharing containers incorporated into a public registry is also described.
The third chapter of this section delves into checking automatically that any new code introduced in the container follows basic quality guidelines, including passing all the tests. It presents continuous integration practices and demonstrates how to create a pipeline in the cloud with Travis CI that will be integrated into a GitHub repository. How to push the resulting container automatically into a registry is also covered in this chapter.
This section comprises the following chapters: