Rocket.Chat is a self-hosted team messaging platform — a Slack alternative you fully control, with support for channels, direct messages, and video calls.
Prerequisites
- Docker Engine and Docker Compose installed
- A domain name (recommended)
- 2 vCPU, 2 GB RAM minimum
Step 1 — Create a Project Directory
mkdir ~/rocketchat && cd ~/rocketchat
Step 2 — Create docker-compose.yml
services:
mongodb:
image: mongo:6
restart: unless-stopped
command: mongod --replSet rs0 --oplogSize 128
volumes:
- mongo_data:/data/db
mongo-init-replica:
image: mongo:6
command: >
mongosh mongodb://mongodb:27017 --eval
"rs.initiate({_id: 'rs0', members: [{_id: 0, host: 'mongodb:27017'}]})"
depends_on:
- mongodb
rocketchat:
image: rocket.chat:latest
restart: unless-stopped
environment:
- MONGO_URL=mongodb://mongodb:27017/rocketchat?replicaSet=rs0
- MONGO_OPLOG_URL=mongodb://mongodb:27017/local?replicaSet=rs0
- ROOT_URL=https://chat.yourdomain.com
- PORT=3000
ports:
- "3000:3000"
depends_on:
- mongodb
volumes:
mongo_data:
Rocket.Chat requires MongoDB running as a replica set (even single-node) for its real-time features to function correctly.
Step 3 — Start the Stack
docker compose up -d
Wait a minute for the replica set initialization to complete before proceeding.
Step 4 — Access Rocket.Chat
http://YOUR_SERVER_IP:3000
Step 5 — Complete the Setup Wizard
Create your administrator account and configure basic organization details.
Step 6 — Add HTTPS
See How to Install Nginx Proxy Manager with Docker — ensure WebSocket support is enabled in the proxy configuration, since Rocket.Chat relies heavily on WebSockets for real-time messaging.
Creating Channels
From the admin/main interface, create channels for your team, configure permissions, and invite users.
Setting Up Push Notifications
Configure push notification gateway settings in the admin panel for mobile app notifications — consult Rocket.Chat's official documentation for current configuration requirements.
Backing Up Rocket.Chat
docker exec rocketchat-mongodb-1 mongodump --archive=/data/db/backup.archive
docker cp rocketchat-mongodb-1:/data/db/backup.archive ./rocketchat-backup.archive
Common Errors
"MongoNetworkError" on startup — the replica set initialization may not have completed; wait longer, or manually verify with mongosh inside the MongoDB container.
Real-time messages don't update without refresh — confirm your reverse proxy correctly passes WebSocket connections (the Upgrade/Connection headers).
Best Practices
- Ensure the reverse proxy explicitly supports WebSockets
- Back up MongoDB regularly given it holds all messages and user data
- Monitor resource usage as your team/message volume grows
Related Articles
- How to Run MySQL, PostgreSQL & Redis in Docker Containers
- How to Install Nginx Proxy Manager with Docker
- Nginx as a Reverse Proxy for Node.js/Docker Apps
