Deploying Multiple Spring Boot Microservices using Docker Compose
- Create custom docker network named consumer-producer network
- Start Container named producer using image employee-producer and the custom network consumer-producer
- Start Container named consumer using image employee-consumer and the custom network consumer-producer
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with a single command, you create and start all the services from your configuration.
Using docker-compose we will be creating the custom network named consumer-producer and then starting the containers employee-producer and employee consumer.

Using Compose is basically a three-step process-
- Define your app's environment with a Dockerfile so it can be reproduced anywhere.
- Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.
- Run docker-compose up and Compose starts and runs your entire app.
Docker Tutorial - Table Of Contents
Docker Deploying Spring Based WAR Application to Docker Deploying Spring Based JAR Application to Docker Deploying Multiple Spring Boot Microservices using Docker Networking Deploying Multiple Spring Boot Microservices using Docker Compose Deploying Spring Boot + MYSQL Application to Docker Publishing Docker Image to DockerHub Deploy Docker Swarm services using Play With Docker Deploy Docker Swarm services using Docker Stack Deploy Docker Swarm services to multiple AWS EC2 instances Docker Cheat Sheet
Video
This tutorial is explained in the below Youtube Video.Lets Begin-
The employee-producer and employee consumer projects will be exactly similar to what we did in previous docker networking tutorial. Check if docker-compose is installed by checking the version-docker-compose --version

We will be installing the docker compose as follows-
curl -L https://github.com/docker/compose/releases/download/1.3.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

Now again lets check the docker-compose version

Now docker-compose is installed. Next we will be creating the docker-compose file as follows-
version: "3" services: consumer: image: employee-consumer networks: - consumer-producer depends_on: - producer producer: image: employee-producer ports: - "8080:8080" networks: - consumer-producer networks: consumer-producer: