Docker Compose defines and runs a multi-container application from one declarative YAML file. Instead of starting and wiring each microservice separately, a single command brings up the complete stack. section 8.2.2
Listing 8.5 docker-compose.yaml
version: "3.9" #1
services:
web: #2
build: ./web
container_name: realtime-voice-web
ports: ["8000:8000"]
environment: #3
OPENAI_API_KEY: ${OPENAI_API_KEY}
DEFAULT_MODEL: ${DEFAULT_MODEL:-gpt-4o-realtime-preview-2025-06-03}
DEFAULT_VOICE: ${DEFAULT_VOICE:-alloy}
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-*}
depends_on:
- image_agent
- web_agent
image_agent: #4
build: ./image_agent
container_name: realtime-image-agent
ports: ["8001:8000"]
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY}
web_agent: #5
build: ./web_agent
container_name: realtime-web-agent
ports: ["8002:8000"]
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY}
WEB_AGENT_MODEL: ${WEB_AGENT_MODEL:-gpt-5-mini}
The Compose file organizes services, build directories, container names, ports, environment variables, and startup dependencies. section 8.2.2
A practical Compose workflow is:
- Prepare the environment file and set required values such as OPENAI_API_KEY. section 8.5
- Run docker compose up --build to build images and start the stack. section 8.2.2 section 8.5
- Open the local web interface, inspect logs, verify service routing, and stop the stack with docker compose down. section 8.5
A three-service agent stack
A Compose deployment can run realtime-voice-web, realtime-image-agent, and realtime-web-agent together. The web service exposes port 8000, depends on the agent services, and routes image or web requests to specialized containers. section 8.2.2














