Search⌘ K
AI Features

Putting Everything Together With Docker Compose

Explore how to integrate and deploy the entire reactive web application stack using Docker Compose. Understand building Docker images for backend, frontend, and MongoDB services, configuring networks, environment variables, ports, and persistence. Learn commands to build, run, and manage all containers together efficiently.

We'll cover the following...

We’ll build these images and run the whole application via a Docker Compose file that is located in the docker folder in the GitHub repository.

These instructions are for locally running the application with Docker Compose.

YAML
version: "2"
services:
mongo:
image: mongo:3.4
hostname: mongo
ports:
- "27017:27017"
volumes:
- mongodata:/data/db
networks:
- network-reactive
spring-boot-reactive:
build:
context: ../spring-boot-reactive-web
image: spring-boot-reactive-web-tpd
environment:
# Overrides the host in the Spring Boot application to use the Docker's hostname
- SPRING_DATA_MONGODB_HOST=mongo
ports:
- "8080:8080"
networks:
- network-reactive
angular-reactive:
build:
context: ../angular-reactive
image: angular-reactive-tpd
ports:
- "4200:1827"
networks:
- network-reactive
volumes:
mongodata:
networks:
network-reactive:

This file is all we need for Docker to find out how to build the corresponding images and how to run the containers together. Let’s describe its main features: ...