This guide uses Docker Compose to run Mattermost Team Edition in containers with PostgreSQL database.
For Docker installation, see Docker.
Create a docker-compose.yml file with the following content:
version: '3.8'
services:
app:
image: mattermost/mattermost-team-edition:latest
container_name: mattermost
restart: unless-stopped
ports:
- "8065:8065"
environment:
- MM_SQLSETTINGS_DRIVERNAME=postgres
- MM_SQLSETTINGS_DATASOURCE=postgres://mmuser:mmuser_password@db:5432/mattermost?sslmode=disable
- MM_SERVICESETTINGS_SITEURL=https://mattermost.example.com
volumes:
- ./volumes/app/mattermost/config:/mattermost/config
- ./volumes/app/mattermost/data:/mattermost/data
- ./volumes/app/mattermost/logs:/mattermost/logs
- ./volumes/app/mattermost/plugins:/mattermost/plugins
depends_on:
- db
db:
image: postgres:14
container_name: mattermost-db
restart: unless-stopped
environment:
- POSTGRES_USER=mmuser
- POSTGRES_PASSWORD=mmuser_password
- POSTGRES_DB=mattermost
volumes:
- ./volumes/db:/var/lib/postgresql/data
Security Note: Replace the following before deployment:
mmuser_password - Strong database passwordhttps://mattermost.example.com - Your Mattermost server URLdocker compose up -d
Wait for the containers to start (approximately 1-2 minutes for first run).
Open http://YOUR-SERVER:8065 to access Mattermost.
On first access, you’ll be prompted to create an admin account.
For production deployments:
Add these environment variables for email:
environment:
- MM_EMAILSETTINGS_SMTPSERVER=smtp.example.com
- MM_EMAILSETTINGS_SMTPPORT=587
- MM_EMAILSETTINGS_CONNECTIONSECURITY=STARTTLS
- MM_EMAILSETTINGS_USERNAME=smtp-user
- MM_EMAILSETTINGS_PASSWORD=smtp-password
- MM_EMAILSETTINGS_FEEDBACKEMAIL=noreply@example.com
For large deployments, consider S3-compatible storage:
environment:
- MM_FILESETTINGS_DRIVERNAME=amazons3
- MM_FILESETTINGS_AMAZONS3ACCESSKEYID=your-access-key
- MM_FILESETTINGS_AMAZONS3SECRETACCESSKEY=your-secret-key
- MM_FILESETTINGS_AMAZONS3BUCKET=your-bucket-name
See Configuration and Security for production hardening.
Any questions?
Feel free to contact us. Find all contact information on our contact page.