What are microservices and containers

Architectural design of container and microservice based applications

  • 2 minutes to read

Microservices offer many advantages, but they also present great new challenges. Microservice architecture patterns are a basic requirement for building a microservice-based application.

In this guide, you've already learned the basic concepts for containers and Docker. This is the minimum information you need to get started with containers. Although containers are key components of microservices and are recommended for them, they are not required for a microservices architecture. Many of the architecture concepts in this architecture section can be applied without a container. However, the focus of this guide is on the intersection of both methods, as the importance of containers has already been introduced.

Enterprise applications can be complex. They often consist of multiple services rather than a single, service-based application. In these cases, you need to be familiar with other architectural approaches, such as: B. Microservices, certain DDD patterns (Domain-Driven Design) and orchestration concepts for containers. Note that this chapter describes not only microservices on containers, but also container applications.

Container design guidelines

In the container model, an instance of a container image represents a single process. By defining a container image as a process boundary, you can create basic types that can be used to scale or stack the process.

When you have designed a container image, the ENTRYPOINT definition is displayed in the Docker file. This defines the process whose lifespan controls the lifespan of the container. When the process is complete, the container's life cycle ends. Containers can represent long-lived processes such as web servers, but also short-lived processes such as batch jobs (previously implemented as Azure WebJobs).

If the process fails, the container halts and the orchestrator takes its place. If the orchestrator has been configured to run five instances and one of them fails, the orchestrator creates another container instance to replace the failed process. The process is started with parameters in a batch job. When the process is done, the job is done. This guide will go into more detail about orchestrators at a later date.

There are scenarios where you want multiple processes to run in a single container. Since there can only be one entry point per container, for this scenario you can run a script inside the container that starts as many programs as needed. For example, you can use Supervisor or a similar tool to start multiple processes within a single container. Even if there are architectures that can contain multiple processes per container, this approach is rather uncommon.