Docker Compose - what? why? and how? - complex applications on "click"

In the world I know change is the only constant and support, installation of software changes over time so I'll just mention that I prepared today's lab based on Debian 11.7 and Docker version 24.0.2. Version current as of June 2023.

 

The description should be as compatible as possible with docker on Ubuntu Windows or MACos. Windows of course after installing WSL which is simply Ubuntu. Installation may differ, but docker compose support should be virtually identical. By design, docker is made to be independent of the operating system hosting it. Support can and does change with a known version of Docker but not between the systems hosting it.

Docker what is it all about?

In a word of very brief introduction. Docker itself is used to create micro services. What does that mean? It means that even the most complex service is broken down into the smallest elements such as database, web server, cache server and whatever else is needed in such an application. With the right level of development, we can even break applications into separate parts performing their separate roles independently. This has a lot of advantages over, for example, a single logical server on which we install everything. The only option for scaling such a monoblock application is to increase RAM or the number of processors. Quite quickly we run into a wall. Among other things, breaking it up into microservices means that we can spread the load across multiple logical functions. Each of these functions can be handled by a different server. Additionally, using the web server as an example, we can run multiple instances of it, even on multiple physical servers. This gives tremendous scalability.

Docker Compose what is it all about?

Well, and great just what is this docker compose for?

 

As you might have gathered from the laconic introduction, there can be quite a few of these containers. The simplest applications consist of a single container but are rare. In practice, the smallest ones consist of the application itself and the database. Sure, you can build a container yourself containing all the necessary components in one container. It's just that this is simply not done because this is exactly the monoblock design we are trying to get away from.

 

So we already know that we can have at least several types of these containers for our service. As an example, I will show how to fire up a Zabbix server that consists of four different containers.

 

Well, that brings us back to docker compose. With its help, as if from bricks, we will create quite a complex service with the help of one not too complicated file and one command.

How does it work?

We can liken it to an application recipe. By default, such an application description file is called docker-compose.yml. It contains a detailed description of the elements of which our application will consist. A description of how it is to be connected to the network, how the various elements of the application are to communicate with each other. In a word, everything you need to create an absolutely reproducible environment for our application, no matter where and how it is run will give the same effect. To see how to do it I invite you to watch a new video on YT.

 

This is what Docker Compose-style containerization would look like in a nutshell. Remember, you always need to do an additional database dump in addition to copying the container files themselves because copying database files is definitely not the optimal way to backup a database. And regarding ready-made docker-compose.yml files for other applications, you will find plenty of them on the Internet, but remember that definitely not all of them are sensible.

 

 

If you would like to learn more about TrueNAS write to us. We will tell you how it works and why it is worth it?