Introduction to Docker Compose
A composing system for containers is a tool that allows us to describe the whole microservices architecture program in a configuration file and then perform operations on the system described. Docker Compose is one such tool. Before we get into what Docker Compose is and does, let's look at the reason why we need a tool like this.
The problem with .sh scripts
So far, we've been using .sh
scripts to make working with our microservices application easy. We have used the following scripts:
- start-mongodb.sh
- start-redis.sh
- start-mosca.sh
subscriber/
start-subscriber.shpublisher/
start-publisher.shsubscriber/
build.shpublisher/
build.shsubscriber/
push.shpublisher/
push.sh
Instead of having to invoke each of these as separate commands, we can make a single start-all.sh script that invokes them all:
#!/bin/sh ./start-mosca.sh ./start-mongodb.sh ./start-redis.sh cd subscriber && ./start...