To self-host a Slack alternative with Mattermost and Docker, install Mattermost on a VPS, configure its Docker environment file, start the application and database containers, and create the first admin account. This setup lets you run private team chat, file sharing, and workspace integrations on infrastructure you control.
You can install Mattermost manually with Docker Compose if you want control over the deployment files, database settings, and reverse proxy configuration. You can also deploy Mattermost faster with Hostinger’s Docker template if you want a ready-made setup that reduces manual server configuration.
To set up your private Mattermost workspace:
- Prepare a VPS with Docker and Docker Compose.
- Configure the Mattermost environment file.
- Start Mattermost with Docker Compose.
- Deploy Mattermost with Hostinger’s Docker template as an easier alternative.
- Create the first admin account.
- Set up private channels, users, and workspace security.
What do you need to self-host Mattermost with Docker?
To self-host Mattermost with Docker, you need a VPS, Docker Engine, Docker Compose, SSH access, and a domain or subdomain for the Mattermost workspace. These requirements let you run Mattermost as a containerized service and access the workspace through a browser.
Before starting the installation, prepare the following:
- A Linux VPS – Use a server with enough CPU, RAM, and storage for your team size, file uploads, plugins, and message history.
- Docker Engine and Docker Compose – Mattermost uses Docker Compose to run the application, database, and optional NGINX reverse proxy containers.
- SSH access – You need terminal access to install packages, clone the Mattermost Docker repository, edit the .env file, and start the containers.
- A domain or subdomain – Use a subdomain like chat.example.com and point it to your VPS IP address before enabling HTTPS.
- An admin email address – Mattermost uses this for support and workspace-related settings. SMTP is optional during setup, but it is useful for invitations and password resets.
Once these requirements are ready, you can install Mattermost manually with Docker Compose or use Hostinger’s Docker template to deploy it with fewer manual configuration steps.
How to install Mattermost with Docker
You can install Mattermost with Docker by deploying the official Mattermost Docker repository on a Linux VPS. This method uses Docker Compose to run Mattermost as separate application and database containers, with an optional NGINX container for HTTPS access. Mattermost officially supports Docker server deployments on Linux, while macOS and Windows Docker setups are intended for testing and development only.
1. Connect to your VPS
First, connect to your server using SSH:
ssh root@your_server_ip
Replace your_server_ip with your VPS IP address. If you use a non-root user, replace root with your server username.
Before installing Mattermost, update the server packages:
sudo apt update && sudo apt upgrade -y
This prepares the VPS for Docker, Docker Compose, and the Mattermost containers.
2. Install Docker and Docker Compose
Mattermost requires Docker Engine and Docker Compose. According to Mattermost’s documentation, Docker Compose version 1.28 or later is required for Docker-based deployment.
Install Docker on Ubuntu with:
sudo apt install docker.io docker-compose-plugin -y
Start and enable Docker:
sudo systemctl enable --now docker
Check that Docker is running:
docker --version docker compose version
If both commands return version numbers, the server is ready for the Mattermost Docker files.
3. Clone the Mattermost Docker repository
Next, download the official Mattermost Docker deployment repository and move into its directory:
git clone https://github.com/mattermost/docker cd docker
This repository contains the Docker Compose files, environment example file, and supporting scripts needed to deploy Mattermost. Mattermost’s official installation flow starts with this repository, not the deprecated mattermost-docker repository.
4. Create the Mattermost environment file
Create the .env file by copying the example file:
cp env.example .env
Open the file with a text editor:
nano .env
At a minimum, update the DOMAIN value so it matches the domain you want to use for your Mattermost server:
DOMAIN=chat.example.com
Replace chat.example.com with your real domain or subdomain. The domain should already point to your VPS IP address through an A record.
Mattermost also recommends setting up a support email address with MM_SUPPORTSETTINGS_SUPPORTEMAIL. This email is shown to users when they need help with the workspace.
Example:
MM_SUPPORTSETTINGS_SUPPORTEMAIL=support@example.com
For a private team chat setup, also review the database credentials in the .env file and replace default passwords with strong values before starting the containers.
5. Create Mattermost volume directories
Mattermost needs persistent directories for configuration files, uploads, logs, plugins, and search indexes. Create the required directories with:
mkdir -p ./volumes/app/mattermost/{config,data,logs,plugins,client/plugins,bleve-indexes}
Then set the correct ownership:
sudo chown -R 2000:2000 ./volumes/app/mattermost
These volumes keep Mattermost data outside the application container. This means your configuration, uploaded files, plugins, and logs remain available when the container is restarted or redeployed.
6. Start Mattermost with Docker Compose
You can start Mattermost with or without the included NGINX reverse proxy.
For a basic deployment without the included NGINX container, run:
docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d
This starts Mattermost on port 8065. After the containers are running, open:
http://your-domain.com:8065/
For a production setup with the included NGINX reverse proxy, run:
docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
This lets you access Mattermost through:
https://your-domain.com/
The NGINX-based option is better for a public-facing team chat because it supports HTTPS access through your domain. Mattermost’s Docker setup creates separate containers for the application and database, and adds a third container when the included NGINX reverse proxy is used.
Check that the containers are running:
docker compose ps
If a container is not running, inspect the logs:
docker compose logs
7. Open Mattermost and create the admin account
Open your Mattermost URL in a browser. Use the domain and access method you selected in the previous step:
http://your-domain.com:8065/
or:
https://your-domain.com/
Create the first user account from the setup screen. This first account becomes the Mattermost system admin, allowing you to manage workspace settings, invite users, create teams, and configure channels.
After creating the admin account, set up your first team and create channels for your organization. For private team chat, start with channels for departments, projects, or internal announcements, then invite only the users who need access.
How to deploy Mattermost with Hostinger’s Docker template
You can deploy Mattermost faster with Hostinger’s Docker template if you prefer a preconfigured setup over installing the application manually from the command line. Hostinger’s Docker catalog lets you launch applications from ready-made templates, and the Mattermost template is built for self-hosted team communication with messaging, file sharing, integrations, and persistent chat history.
1. Open the Mattermost Docker template
Go to Hostinger’s Mattermost Docker template page and choose Deploy. This starts the VPS setup flow with Mattermost selected as the application template.
Hostinger lists Mattermost as an open-source team collaboration platform for messaging, file sharing, and integrations. The template page also recommends the KVM 2 VPS plan, which includes 2 vCPU cores, 8 GB RAM, 100 GB NVMe storage, and 8 TB bandwidth.
2. Choose a VPS plan
Select a VPS plan based on your team size, message history, file uploads, and integration usage. A small team can start with the recommended plan, while larger teams should choose more CPU, RAM, and storage to support more concurrent users, uploaded files, plugins, and search activity.
For a private team chat, prioritize three resources:
- RAM for active users, plugins, and background services.
- Storage for uploaded files, message history, logs, and backups.
- CPU for search, integrations, notifications, and concurrent activity.
Choosing enough resources from the start helps Mattermost stay responsive when users send messages, upload files, and search old conversations.
3. Complete the template deployment
After choosing the plan, complete the VPS checkout and deployment flow. Hostinger provisions the VPS and installs Mattermost from the Docker template, so you do not need to manually clone the Mattermost Docker repository, create Compose files, or configure the base containers yourself.
This template-based method is useful when the goal is to quickly get a working Mattermost instance. Use the manual Docker method instead if you need full control over the Docker Compose files, environment variables, reverse proxy configuration, or database setup.
4. Open your Mattermost instance
When the deployment finishes, open the Mattermost instance using the access details shown in hPanel. Depending on your VPS and domain setup, this can be a server IP address, temporary access URL, or domain-based URL.
For a production workspace, connect a domain or subdomain such as chat.example.com to your VPS. A dedicated subdomain makes the Mattermost workspace easier for team members to remember and separates internal chat from your main website.
5. Create the first admin account
Open the Mattermost setup screen and create the first user account. This account becomes the system admin, who controls the workspace settings, teams, users, channels, permissions, and integrations.
Use a strong admin password and store the credentials securely. The admin account has full access to workspace configuration, so it should not be shared between team members.
6. Configure your private team chat workspace
After creating the admin account, set up the workspace for internal communication. Start with the core structure your team needs:
- Create a main team for your organization.
- Add public channels for company-wide updates.
- Add private channels for departments, projects, or leadership discussions.
- Invite users who need access to the workspace.
- Review notification, file sharing, and permission settings.
- Add integrations only after the main chat structure is ready.
Mattermost supports unlimited teams, channels, message history, one-on-one and group messaging, threaded conversations, file sharing, audio and video calls, advanced search, mobile apps, and integrations with tools such as Jira, GitHub, Zoom, and Jenkins. These features make the Hostinger deployment suitable for a private Slack alternative where the team controls its own communication environment.
7. Secure the deployment before inviting the whole team
Before inviting every user, review the server and workspace security settings. Enable HTTPS for the domain, keep the VPS up to date, use strong passwords, and configure backups for Mattermost data and uploaded files.
Hostinger describes Mattermost on VPS as a setup that gives teams control over data ownership, authentication, SSL certificates, backup strategies, and compliance requirements. For a private team chat, these controls are the main reason to self-host Mattermost rather than rely on a cloud-only workspace.
When should you self-host Mattermost instead of using Slack?
You should self-host Mattermost instead of using Slack when your team needs more control over its communication data, infrastructure, access rules, and long-term workspace costs. Slack is a managed cloud platform, while Mattermost can run on your own VPS, making it a better fit for teams that want a private chat environment they can configure, secure, and maintain independently.
Self-hosting Mattermost is especially useful for technical teams, agencies, startups, internal departments, and organizations with stricter privacy or compliance requirements. Since the workspace runs on your own server, you decide where the data is stored, who can access it, how backups work, and which integrations are allowed.
|
Choose Mattermost if you need… |
Choose Slack if you need… |
|
A self-hosted team chat platform |
A fully managed cloud workspace |
|
More control over data storage and backups |
Minimal server maintenance |
|
Private channels hosted on your own VPS |
Fast setup without infrastructure management |
|
Custom authentication, permissions, and security rules |
A large SaaS integration ecosystem by default |
|
Predictable infrastructure-based costs |
A per-user SaaS subscription model |
|
More control over updates, plugins, and deployment settings |
Automatic platform updates handled by the provider |
Mattermost is a better option when data ownership is the main priority. For example, a software agency can use Mattermost to create private client channels, store project discussions on its own VPS, and control which users, plugins, and integrations are allowed inside the workspace.
Slack is a better option when convenience is the main priority. For example, a non-technical team that does not want to manage a VPS, Docker containers, updates, SSL certificates, or backups may prefer Slack because the platform handles the infrastructure.
For most self-hosting use cases, the decision comes down to control versus convenience. Choose Mattermost if you want to own and manage your private team chat environment. Choose Slack if you want a hosted collaboration tool that removes server administration from your workflow.
All of the tutorial content on this website is subject to
Hostinger’s rigorous editorial standards and values.
Apply for Premium Hosting
Source Credit: https://www.hostinger.com/in/tutorials/how-to-self-host-mattermost-docker
