docker.recipes

RethinkDB Realtime Database

beginner

RethinkDB document database with real-time change feeds.

Overview

RethinkDB is an open-source NoSQL document database engineered from the ground up for real-time applications. Unlike traditional databases that require polling for updates, RethinkDB features built-in change feeds that push live updates to applications whenever data changes. Developed by the RethinkDB team and later maintained by the community, it uses the ReQL (RethinkDB Query Language) which allows developers to write expressive queries that can subscribe to changes and automatically receive notifications when documents are modified, inserted, or deleted. This Docker configuration deploys a single RethinkDB instance with the web administration interface exposed on port 8080, the driver port on 28015 for client connections, and the cluster port on 29015 for distributed deployments. RethinkDB excels in scenarios requiring live data synchronization such as collaborative applications, real-time analytics dashboards, and chat systems where users need immediate updates without refresh cycles. This setup is ideal for developers building real-time web applications, startups prototyping collaborative tools, and teams needing a database that can handle both complex queries and live data feeds. The combination of RethinkDB's intuitive query language, automatic change notifications, and built-in web interface makes it particularly valuable for rapid development of applications that require instant data synchronization across multiple clients.

Key Features

  • Real-time change feeds that automatically push updates to subscribed queries
  • ReQL query language with chainable commands and built-in real-time capabilities
  • Web-based administration interface for database management and query testing
  • Automatic document indexing with support for compound and multi-dimensional indexes
  • Built-in map-reduce functionality for aggregating data across documents
  • Atomic operations and transactions within single documents
  • Geographic query support with built-in geospatial indexing
  • Horizontal scaling capabilities with automatic data distribution

Common Use Cases

  • 1Real-time chat applications requiring instant message delivery and presence updates
  • 2Collaborative editing platforms like document editors or design tools with live collaboration
  • 3Live analytics dashboards displaying real-time metrics and business intelligence
  • 4Multiplayer gaming backends tracking player state and game events
  • 5IoT data collection systems processing sensor data streams with live monitoring
  • 6Social media feeds requiring instant updates for likes, comments, and posts
  • 7Financial trading platforms needing real-time price updates and transaction monitoring

Prerequisites

  • Docker and Docker Compose installed with minimum 2GB available RAM for RethinkDB operations
  • Ports 8080, 28015, and 29015 available on the host system
  • Basic understanding of NoSQL document databases and JSON data structures
  • Familiarity with ReQL syntax for writing queries and change feed subscriptions
  • Understanding of real-time application architecture and WebSocket connections
  • Knowledge of JavaScript or Python for client-side RethinkDB driver integration

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 rethinkdb:
3 image: rethinkdb:latest
4 container_name: rethinkdb
5 restart: unless-stopped
6 ports:
7 - "${ADMIN_PORT:-8080}:8080"
8 - "${DRIVER_PORT:-28015}:28015"
9 - "${CLUSTER_PORT:-29015}:29015"
10 volumes:
11 - rethinkdb_data:/data
12 command: rethinkdb --bind all
13 networks:
14 - rethinkdb-network
15
16volumes:
17 rethinkdb_data:
18
19networks:
20 rethinkdb-network:
21 driver: bridge

.env Template

.env
1# RethinkDB
2ADMIN_PORT=8080
3DRIVER_PORT=28015
4CLUSTER_PORT=29015

Usage Notes

  1. 1Admin UI at http://localhost:8080
  2. 2Driver port at 28015
  3. 3Real-time changefeeds
  4. 4ReQL query language

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 rethinkdb:
5 image: rethinkdb:latest
6 container_name: rethinkdb
7 restart: unless-stopped
8 ports:
9 - "${ADMIN_PORT:-8080}:8080"
10 - "${DRIVER_PORT:-28015}:28015"
11 - "${CLUSTER_PORT:-29015}:29015"
12 volumes:
13 - rethinkdb_data:/data
14 command: rethinkdb --bind all
15 networks:
16 - rethinkdb-network
17
18volumes:
19 rethinkdb_data:
20
21networks:
22 rethinkdb-network:
23 driver: bridge
24EOF
25
26# 2. Create the .env file
27cat > .env << 'EOF'
28# RethinkDB
29ADMIN_PORT=8080
30DRIVER_PORT=28015
31CLUSTER_PORT=29015
32EOF
33
34# 3. Start the services
35docker compose up -d
36
37# 4. View logs
38docker 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/rethinkdb-realtime/run | bash

Troubleshooting

  • RethinkDB won't start with 'Insufficient memory' error: Increase Docker memory allocation to at least 2GB or add --cache-size 512 to the command
  • Web interface shows 'Connection failed' at localhost:8080: Verify the container is running and ADMIN_PORT environment variable matches your expected port
  • Client connections fail to port 28015: Check DRIVER_PORT environment variable and ensure no firewall is blocking the connection
  • Change feeds stop working after container restart: Restart client applications as change feed subscriptions don't persist across database restarts
  • High memory usage during large queries: Add --max-cache-size flag to the RethinkDB command to limit memory consumption
  • Cluster connection issues on port 29015: Ensure CLUSTER_PORT is properly exposed and not conflicting with other services

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

Components

rethinkdb

Tags

#rethinkdb#realtime#document#nosql#changefeeds

Category

Database Stacks
Ad Space