Member-only story
Docker Advance Part 5: Separation of Concern in Docker Compose

My articles are open to everyone; non-member readers can read the full article by clicking this link.
Hello developers, welcome back to my Docker Advanced Series where we break down complex Docker concepts into easy-to-digest lessons. If you are new here, you can access the whole series from here.
In today’s post, I am going to show how you can use Separation of Concern in Docker Compose file.
Big Bowl of Mud in Docker Compose
Most of the time I see in projects, developers put every Docker service in one file which makes it unreadable, because file contains more than 100 lines. In order to find something you have to read the whole file.
Let’s say we have a Postgres Database which 3 of your services such as users-service
, payment-service
, transaction-service
. These services are all Spring Boot projects but could be any. Following is a big docker compose file that contains more than 100 lines and could be longer than that.