Getting Started With Docker Compose

In this blog, I will discuss Docker Compose and basic workflow of Docker Compose. But if you don’t know any thing about Docker technology read my blog about Docker first.

Docker Compose, a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.Docker Compose is mostly used as a helper when you want to start multiple Docker containers and don’t want to start each one separately using docker run. Docker Compose allows configuring and starting multiple Docker containers. All of that can be done by Docker Compose in the scope of a single host.

Docker Compose Workflow

There are three steps to using Docker Compose:

  • Define each service in a Dockerfile and this will create a container for this service.
  • Define the services and their relation to each other in the docker-compose.yml file. And how they are going to communicate to each other, all the rules are defined in this file.
  • Use docker-compose up to start the system. You have to use only this command to start the whole system.

Fast Update

When you change some file in one service i.e update the code or any other changes, you have to restart the docker-compose to reflect the changes but the important things is that, only those containers are going to build again whcih are updated. Compose re-uses the existing containers. Re-using containers means that you can make changes to your environment very quickly.

If you want to deploy a website using Docker Compose check out my blog on deployment (Click here to go to deployment blog).

One thought on “Getting Started With Docker Compose

Leave a comment