docker.recipes

Rocket.Chat Team Platform

intermediate

Rocket.Chat team communication with MongoDB.

Overview

Rocket.Chat is an open-source team communication platform that provides organizations with complete control over their messaging infrastructure. Originally launched in 2015 as a self-hosted alternative to Slack and Microsoft Teams, Rocket.Chat offers real-time messaging, video conferencing, file sharing, and extensive customization options without vendor lock-in or data privacy concerns inherent in cloud-based solutions. The platform supports unlimited users, channels, and integrations while maintaining enterprise-grade security features like end-to-end encryption and compliance certifications. This deployment combines Rocket.Chat with MongoDB configured as a replica set, which is essential for Rocket.Chat's real-time features and data consistency. MongoDB's oplog (operations log) enables Rocket.Chat to track database changes in real-time, powering live message updates, presence indicators, and notification systems across all connected clients. The replica set configuration, even with a single node, provides the oplog functionality that Rocket.Chat requires for optimal performance. Organizations seeking complete control over their communication data will find this stack particularly valuable. Unlike hosted solutions, this deployment keeps all messages, files, and user data within your infrastructure, making it ideal for companies with strict data governance requirements, government agencies, healthcare organizations, or any team that prioritizes data sovereignty and customization flexibility over convenience.

Key Features

  • Real-time messaging with MongoDB oplog integration for instant message delivery across all clients
  • Built-in video conferencing and screen sharing capabilities without external dependencies
  • Federation support allowing communication with other Rocket.Chat instances and Matrix protocol servers
  • Extensive marketplace with hundreds of apps and integrations including Jira, GitHub, and Zapier
  • Omnichannel customer service features with live chat widgets, WhatsApp, and SMS integration
  • Advanced user management with LDAP/Active Directory sync and custom roles and permissions
  • End-to-end encryption for private conversations and sensitive communications
  • Thread-based discussions and message reactions for organized team collaboration

Common Use Cases

  • 1Remote-first companies needing complete control over communication data and compliance
  • 2Healthcare organizations requiring HIPAA-compliant team communication and patient consultation
  • 3Government agencies and defense contractors with strict data sovereignty requirements
  • 4Educational institutions managing student-teacher communication and virtual classrooms
  • 5Software development teams integrating with GitHub, GitLab, and CI/CD pipelines
  • 6Customer support organizations using omnichannel features for unified communication
  • 7International organizations leveraging federation to connect distributed Rocket.Chat instances

Prerequisites

  • Minimum 4GB RAM recommended (2GB for Rocket.Chat, 2GB for MongoDB with oplog operations)
  • Docker and Docker Compose installed with sufficient storage for MongoDB data growth
  • Port 3000 available for Rocket.Chat web interface access
  • Understanding of MongoDB replica sets and oplog concepts for troubleshooting
  • Valid domain name and SSL certificates for production deployments with federation
  • Network configuration allowing MongoDB replica set initialization and internal communication

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 mongodb:
3 image: mongo:6
4 container_name: rocketchat-mongo
5 restart: unless-stopped
6 command: mongod --oplogSize 128 --replSet rs0
7 volumes:
8 - mongo_data:/data/db
9 networks:
10 - rocketchat-network
11
12 mongo-init-replica:
13 image: mongo:6
14 container_name: mongo-init-replica
15 command: >
16 bash -c "sleep 10 && mongosh mongodb/rocketchat --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "mongodb:27017"}]})'"
17 depends_on:
18 - mongodb
19 networks:
20 - rocketchat-network
21
22 rocketchat:
23 image: rocket.chat:latest
24 container_name: rocketchat
25 restart: unless-stopped
26 ports:
27 - "${ROCKETCHAT_PORT:-3000}:3000"
28 environment:
29 - ROOT_URL=${ROOT_URL:-http://localhost:3000}
30 - MONGO_URL=mongodb://mongodb:27017/rocketchat?replicaSet=rs0
31 - MONGO_OPLOG_URL=mongodb://mongodb:27017/local?replicaSet=rs0
32 - DEPLOY_METHOD=docker
33 depends_on:
34 - mongodb
35 networks:
36 - rocketchat-network
37
38volumes:
39 mongo_data:
40
41networks:
42 rocketchat-network:
43 driver: bridge

.env Template

.env
1# Rocket.Chat
2ROCKETCHAT_PORT=3000
3ROOT_URL=http://localhost:3000

Usage Notes

  1. 1Rocket.Chat at http://localhost:3000
  2. 2Setup wizard on first run
  3. 3Supports federation
  4. 4Many integrations available

Individual Services(3 services)

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

mongodb
mongodb:
  image: mongo:6
  container_name: rocketchat-mongo
  restart: unless-stopped
  command: mongod --oplogSize 128 --replSet rs0
  volumes:
    - mongo_data:/data/db
  networks:
    - rocketchat-network
mongo-init-replica
mongo-init-replica:
  image: mongo:6
  container_name: mongo-init-replica
  command: |
    bash -c "sleep 10 && mongosh mongodb/rocketchat --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "mongodb:27017"}]})'"
  depends_on:
    - mongodb
  networks:
    - rocketchat-network
rocketchat
rocketchat:
  image: rocket.chat:latest
  container_name: rocketchat
  restart: unless-stopped
  ports:
    - ${ROCKETCHAT_PORT:-3000}:3000
  environment:
    - ROOT_URL=${ROOT_URL:-http://localhost:3000}
    - MONGO_URL=mongodb://mongodb:27017/rocketchat?replicaSet=rs0
    - MONGO_OPLOG_URL=mongodb://mongodb:27017/local?replicaSet=rs0
    - DEPLOY_METHOD=docker
  depends_on:
    - mongodb
  networks:
    - rocketchat-network

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 mongodb:
5 image: mongo:6
6 container_name: rocketchat-mongo
7 restart: unless-stopped
8 command: mongod --oplogSize 128 --replSet rs0
9 volumes:
10 - mongo_data:/data/db
11 networks:
12 - rocketchat-network
13
14 mongo-init-replica:
15 image: mongo:6
16 container_name: mongo-init-replica
17 command: >
18 bash -c "sleep 10 && mongosh mongodb/rocketchat --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "mongodb:27017"}]})'"
19 depends_on:
20 - mongodb
21 networks:
22 - rocketchat-network
23
24 rocketchat:
25 image: rocket.chat:latest
26 container_name: rocketchat
27 restart: unless-stopped
28 ports:
29 - "${ROCKETCHAT_PORT:-3000}:3000"
30 environment:
31 - ROOT_URL=${ROOT_URL:-http://localhost:3000}
32 - MONGO_URL=mongodb://mongodb:27017/rocketchat?replicaSet=rs0
33 - MONGO_OPLOG_URL=mongodb://mongodb:27017/local?replicaSet=rs0
34 - DEPLOY_METHOD=docker
35 depends_on:
36 - mongodb
37 networks:
38 - rocketchat-network
39
40volumes:
41 mongo_data:
42
43networks:
44 rocketchat-network:
45 driver: bridge
46EOF
47
48# 2. Create the .env file
49cat > .env << 'EOF'
50# Rocket.Chat
51ROCKETCHAT_PORT=3000
52ROOT_URL=http://localhost:3000
53EOF
54
55# 3. Start the services
56docker compose up -d
57
58# 4. View logs
59docker 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/rocketchat-team/run | bash

Troubleshooting

  • Rocket.Chat shows 'Cannot connect to database' error: Ensure MongoDB replica set is initialized by checking mongo-init-replica container logs and verifying rs.status() in MongoDB shell
  • Real-time features not working (messages don't appear instantly): Verify MONGO_OPLOG_URL is correctly configured and MongoDB oplog is functioning with rs.printReplicationInfo()
  • Rocket.Chat container fails to start with SIGKILL: Increase Docker memory limits as Rocket.Chat requires significant RAM during initialization, especially with MongoDB operations
  • Federation or webhooks not working: Check ROOT_URL environment variable matches your actual domain and is accessible from external services
  • MongoDB replica set fails to initialize: Ensure mongodb container is fully started before mongo-init-replica runs, increase sleep time if necessary
  • File uploads failing or timing out: Verify sufficient disk space in mongo_data volume and adjust MongoDB's GridFS settings for large file handling

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