In the previous post about Dockerfiles, we saw how to use a YAML file to define the template of the docker containers/images and use those set of instructions to build and distribute your containers. However, what if the application that you are writing has multiple components to it.
For example:- You wrote a device monitoring web dashboard using flask. This application will have a core flask framework application, a database, may be another module that connects to multiple services to exchange data. In the world of docker, it is always recommended to have one container do one particular task but do it perfectly. So your application might be composed of 2-3 containers each container doing a specific task.
Docker Compose allows you to programmatically manage multi container applications just like a Dockerfile does it for a single container so that all container look like a single service. These tiny containers/services are often known as microservices. Another term that we get to see a lot these days whenever you talk about docker.
Let’s see some basics of docker compose
If you are on windows / mac, docker-compose is pre installed as a part of docker desktop. For ubuntu and other linux distributions, you can find instructions on docker website.
╰─ docker-compose --version ─╯
Docker Compose version v2.0.0-rc.1
1 thought on “Docker for Network Engineers Part V – Docker Compose”