liveBook · Manning

Docker Compose support

As explained in Spring AI in Action

Docker Compose support is a Spring Boot capability that manages containers defined in a Docker Compose configuration during application startup and shutdown.

Docker Compose support lets a Spring Boot application start containers defined in compose.yaml when the application starts and stop them when it shuts down. It removes the need to manage a database or service separately during local development. section 4.2 section 7.3.2

Typical setup combines:

  • The spring-boot-docker-compose dependency, which starts containers from compose.yaml. section 4.2
  • A service-connection dependency, which configures supported clients such as Spring AI to connect to the containerized service. section 4.2
  • A compose.yaml file describing the required service, image, environment, and ports. section 4.2 section 7.3.2

Qdrant and PostgreSQL

A document application can declare Qdrant on ports 6334 and 6333 for vector storage and debugging. An MCP server can instead declare PostgreSQL, initialize its schema and data, and configure spring.sql.init.mode=always because the Docker database is not embedded. section 4.2 section 7.3.2

services:
  qdrant:
    image: 'qdrant/qdrant:latest'
    ports:
      - '6334:6334'
      - '6333:6333'

Shows the minimal Qdrant service declaration, including its image and port mappings. section 4.2

How Spring AI in Action covers it

How deep it goes
Explains dependencies, Compose configuration, lifecycle management, and service connections without covering container internals.
Examples
Uses Qdrant for vector storage and PostgreSQL for a custom MCP server.
What it assumes
Assumes a Spring Boot project and Compose configuration while teaching container startup through dependencies.
What you can do after
Operate/configure local Qdrant or PostgreSQL services through Compose files and Spring Boot dependencies.
How it connects
Connects Docker Compose with Spring Boot, Spring AI, Qdrant, PostgreSQL, and Spring Data JDBC.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring AI in Action. The section links point to the parts of the book it draws on.