docker.recipes

Feast Feature Store

advanced

Feature store for ML with offline and online serving.

Overview

Feast (Feature Store) is an operational data system for managing and serving machine learning features to models in production. Originally developed by Gojek and later open-sourced, Feast addresses the critical challenge of feature engineering at scale by providing a centralized platform for storing, managing, and serving ML features with consistent offline training and online inference capabilities. The system bridges the gap between data engineering and machine learning by standardizing how features are defined, computed, stored, and retrieved across the entire ML lifecycle. This Docker configuration combines Feast's feature server with Redis as the online feature store and PostgreSQL as the offline feature store, creating a complete feature management pipeline. Redis provides sub-millisecond feature retrieval for real-time model inference, while PostgreSQL handles historical feature storage for training data generation and batch processing. The architecture enables teams to maintain feature consistency between training and serving environments, eliminating training-serving skew that commonly degrades model performance in production. This stack is ideal for ML teams building production systems that require both historical feature access for model training and low-latency feature serving for real-time predictions. The combination offers enterprise-grade reliability with PostgreSQL's ACID compliance for critical feature lineage and Redis's proven performance for high-throughput inference workloads, making it suitable for organizations scaling from prototype ML models to production feature stores serving thousands of requests per second.

Key Features

  • Dual-store architecture with Redis online store for sub-millisecond feature retrieval and PostgreSQL offline store for historical analysis
  • Feature registry in PostgreSQL with versioning, lineage tracking, and metadata management for reproducible ML experiments
  • Time-travel queries enabling point-in-time correct feature retrieval for training data generation without data leakage
  • Materialization engine for syncing features from offline PostgreSQL storage to online Redis cache on configurable schedules
  • Feature server REST API on port 6566 supporting both online feature retrieval and offline feature extraction
  • Redis hash-based feature storage optimized for batch feature retrieval across multiple entities and feature groups
  • PostgreSQL JSONB support for flexible feature schema evolution without breaking existing feature definitions
  • Feast CLI integration for feature definition deployment, data source registration, and infrastructure management

Common Use Cases

  • 1Real-time recommendation systems requiring millisecond feature lookups for user preferences, item embeddings, and contextual signals
  • 2Fraud detection models needing historical transaction patterns from PostgreSQL and real-time account features from Redis
  • 3ML model training pipelines requiring consistent feature definitions between offline training and online serving environments
  • 4A/B testing frameworks where feature flags and user segments must be consistently applied across training and inference
  • 5Financial trading algorithms needing both historical market data analysis and real-time feature serving for trade decisions
  • 6Customer churn prediction models combining long-term behavioral patterns with real-time activity features
  • 7MLOps platforms centralizing feature engineering across multiple data science teams and model deployments

Prerequisites

  • Minimum 2GB RAM (512MB for Redis online store, 1GB for PostgreSQL offline store, 512MB for Feast server)
  • Docker Engine 20.10+ and Docker Compose 2.0+ with networking capabilities for inter-service communication
  • Available ports 6566 (Feast API), 6379 (Redis), and 5432 (PostgreSQL) for service access
  • Understanding of feature store concepts including entities, feature views, and online/offline stores
  • Python environment for Feast SDK usage and feature definition management outside containers
  • Basic knowledge of SQL for PostgreSQL feature queries and Redis data structures for online serving optimization

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 feast:
3 image: feastdev/feature-server:latest
4 container_name: feast
5 restart: unless-stopped
6 command: feast serve -h 0.0.0.0 -p 6566
7 volumes:
8 - ./feature_repo:/feature_repo
9 working_dir: /feature_repo
10 ports:
11 - "6566:6566"
12 depends_on:
13 - redis
14 - postgres
15 networks:
16 - feast
17
18 redis:
19 image: redis:alpine
20 container_name: feast-redis
21 ports:
22 - "6379:6379"
23 networks:
24 - feast
25
26 postgres:
27 image: postgres:16-alpine
28 container_name: feast-postgres
29 environment:
30 POSTGRES_DB: feast
31 POSTGRES_USER: feast
32 POSTGRES_PASSWORD: feast
33 volumes:
34 - postgres_data:/var/lib/postgresql/data
35 networks:
36 - feast
37
38volumes:
39 postgres_data:
40
41networks:
42 feast:
43 driver: bridge

.env Template

.env
1# Initialize with: feast init feature_repo

Usage Notes

  1. 1Docs: https://docs.feast.dev/
  2. 2Feature server API at http://localhost:6566
  3. 3Initialize: feast init feature_repo, then cd feature_repo
  4. 4Register features: feast apply - reads feature_store.yaml
  5. 5Materialize: feast materialize-incremental $(date -u +%Y-%m-%dT%H:%M:%S)
  6. 6Get features: store.get_online_features(features=[...], entity_rows=[...])

Individual Services(3 services)

Copy individual services to mix and match with your existing compose files.

feast
feast:
  image: feastdev/feature-server:latest
  container_name: feast
  restart: unless-stopped
  command: feast serve -h 0.0.0.0 -p 6566
  volumes:
    - ./feature_repo:/feature_repo
  working_dir: /feature_repo
  ports:
    - "6566:6566"
  depends_on:
    - redis
    - postgres
  networks:
    - feast
redis
redis:
  image: redis:alpine
  container_name: feast-redis
  ports:
    - "6379:6379"
  networks:
    - feast
postgres
postgres:
  image: postgres:16-alpine
  container_name: feast-postgres
  environment:
    POSTGRES_DB: feast
    POSTGRES_USER: feast
    POSTGRES_PASSWORD: feast
  volumes:
    - postgres_data:/var/lib/postgresql/data
  networks:
    - feast

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 feast:
5 image: feastdev/feature-server:latest
6 container_name: feast
7 restart: unless-stopped
8 command: feast serve -h 0.0.0.0 -p 6566
9 volumes:
10 - ./feature_repo:/feature_repo
11 working_dir: /feature_repo
12 ports:
13 - "6566:6566"
14 depends_on:
15 - redis
16 - postgres
17 networks:
18 - feast
19
20 redis:
21 image: redis:alpine
22 container_name: feast-redis
23 ports:
24 - "6379:6379"
25 networks:
26 - feast
27
28 postgres:
29 image: postgres:16-alpine
30 container_name: feast-postgres
31 environment:
32 POSTGRES_DB: feast
33 POSTGRES_USER: feast
34 POSTGRES_PASSWORD: feast
35 volumes:
36 - postgres_data:/var/lib/postgresql/data
37 networks:
38 - feast
39
40volumes:
41 postgres_data:
42
43networks:
44 feast:
45 driver: bridge
46EOF
47
48# 2. Create the .env file
49cat > .env << 'EOF'
50# Initialize with: feast init feature_repo
51EOF
52
53# 3. Start the services
54docker compose up -d
55
56# 4. View logs
57docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/feast/run | bash

Troubleshooting

  • Error 'No module named feast': Install Feast SDK locally with pip install feast for CLI operations outside containers
  • feast apply fails with database connection error: Ensure PostgreSQL container is healthy and POSTGRES_DB environment matches feature_store.yaml configuration
  • Feature server returns 404 for registered features: Run feast materialize to sync offline features to Redis online store before querying
  • Redis connection timeout during high load: Increase Redis maxclients setting and consider Redis Cluster for horizontal scaling
  • PostgreSQL disk space issues with large feature datasets: Implement table partitioning by date and configure automated cleanup policies
  • Feast CLI commands hang: Verify feature_repo directory contains valid feature_store.yaml and feature definitions before running feast commands

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space