Skip to content

Mattermost

Mattermost Docker setup: self-hosted Mattermost with Docker Compose

Run Mattermost with Docker using its official compose files, with PostgreSQL and HTTPS through NGINX. Or skip the server and get Mattermost hosting on Zenith.

· $20 a month on Zenith · PostgreSQL included

Deploy with Zenith

The short version

Host it on Zenith if

  • You want Mattermost on a public HTTPS address without setting up NGINX and certificates.
  • You don't want to run PostgreSQL or handle Mattermost upgrades.
  • You want one price for the whole team, not per person.

Run it yourself if

  • You need a paid Mattermost licence for single sign-on, AD/LDAP or compliance features.
  • Mattermost has to run inside your own network.
  • You want to decide exactly when Mattermost upgrades.

To run Mattermost with Docker, clone Mattermost's official mattermost/docker repository, set your domain in .env, create the data folders, and start Mattermost, PostgreSQL and NGINX with Docker Compose. It takes a Linux server, a domain and a certificate. Or skip the server: Mattermost hosting on Zenith is $20 a month for the whole team.

What Mattermost needs

Mattermost is team chat: channels, threads, direct messages and file sharing, with desktop and phone apps. The server is a single application backed by PostgreSQL.

Mattermost's own Docker setup lives in the mattermost/docker repository. It runs Mattermost and PostgreSQL, and optionally NGINX for HTTPS. You need:

  • A Linux server with Docker and Docker Compose. Mattermost supports Docker in production on Linux only.
  • A domain pointed at the server.
  • A certificate for that domain, from Let's Encrypt or one you already have.

Try Mattermost on your own computer

To look around first, Mattermost's docs offer a preview image that runs everything in one container. Don't use it for real data.

docker run --name mattermost-preview -d --publish 8065:8065 --publish 8443:8443 mattermost/mattermost-preview

Open http://localhost:8065 and create the first account.

Install self-hosted Mattermost with Docker Compose

  1. 1

    Get the official compose files

    git clone https://github.com/mattermost/docker cd docker cp env.example .env
  2. 2

    Set your domain and edition

    Open .env and set DOMAIN to your domain. Change POSTGRES_PASSWORD from its default. The file uses the enterprise image by default. For Team Edition, set:

    DOMAIN=chat.example.com MATTERMOST_IMAGE=mattermost-team-edition

    Pin MATTERMOST_IMAGE_TAG to a version rather than following the latest release.

  3. 3

    Create the data folders

    Mattermost runs as user 2000 inside the container, so its folders need that owner.

    mkdir -p ./volumes/app/mattermost/{config,data,logs,plugins,client/plugins,bleve-indexes} sudo chown -R 2000:2000 ./volumes/app/mattermost
  4. 4

    Get a certificate

    The repository includes a Let's Encrypt script. Run it, then uncomment the CERT_PATH and KEY_PATH lines in .env that point at the ./certs/etc/letsencrypt/live/ files.

    bash scripts/issue-certificate.sh -d chat.example.com -o ${PWD}/certs
  5. 5

    Start Mattermost with NGINX

    docker compose -f docker-compose.yml -f docker-compose.nginx.yml up -d

    Open https://chat.example.com. If you already run a reverse proxy, use docker-compose.without-nginx.yml instead and point your proxy at port 8065.

  6. 6

    Create the first account

    Sign up straight away. The first account on a new Mattermost server becomes the system admin. Then create a team and invite people.

To upgrade, change MATTERMOST_IMAGE_TAG in .env and run the same docker compose ... up -d command again. Back up the PostgreSQL data in ./volumes/db and the ./volumes/app/mattermost folder before every upgrade.

What you skip on Zenith

On your own serverOn Zenith
ServerRent a Linux server and install DockerIncluded
DatabaseRun PostgreSQL and change its default passwordIncluded, with 5 GB of storage
Domain and HTTPSPoint a domain, issue a certificate, run NGINXYour own HTTPS address, or your domain
File storageFolders owned by user 2000 on your disk10 GB for uploaded files to start
UpdatesChange the tag and restartIncluded
BackupsBack up the database and data folders yourselfManaged backups, best effort

Zenith runs Team Edition and does not set up email for Mattermost. To send notification and password reset emails, add your SMTP provider in the System Console under Environment, then SMTP.

Mattermost hosting on Zenith

Zenith runs Mattermost Team Edition for you, with its own PostgreSQL database, for $20 a month. There is no per-person charge. For how Mattermost compares with Slack on price and features, see Mattermost vs Slack.

  1. 1

    Click Deploy now on the Mattermost page

    Open Mattermost in the catalogue and click Deploy now. It costs $20 a month. If you don't have a Zenith account yet, you create one after paying.

  2. 2

    Choose an address

    Pick a name, then click Use this address. Your address becomes the name, a hyphen and your username, ending in .zh.run. Mattermost's Site URL is set to it for you.

  3. 3

    Create your admin account

    When Mattermost is live, open it and create your account right away. As the first account, it becomes the system admin.

  4. 4

    Create a team and invite people

    Create your first team, then copy its invite link and send it to your team. They can sign in from the browser or the Mattermost desktop and phone apps using your address.

Mattermost hosting without the setup

$20 a month for the whole team, with PostgreSQL, an HTTPS address, managed backups and updates.

Deploy with Zenith

Common questions

What is the Mattermost Docker image?
There are two. mattermost/mattermost-team-edition is Team Edition. mattermost/mattermost-enterprise-edition is the build that turns on paid features when you add a licence. Mattermost's compose files default to the enterprise image.
Which database does Mattermost need?
PostgreSQL. Mattermost's Docker setup runs it as a second container.
Who becomes the Mattermost admin?
The first account created on a new Mattermost server is made system admin. Create yours straight after the server starts.
How much does Mattermost cost?
On Zenith it costs $20 a month for the whole team, not per person. Team Edition needs no licence, and Mattermost says it suits teams under 250 active users. Single sign-on, guest accounts and compliance features need a paid licence.
How do I try Mattermost quickly with Docker?
Run the mattermost-preview image on your own computer. It bundles everything in one container for evaluation, and is not meant for production.
Is Docker supported on macOS and Windows?
Only for testing and development. Mattermost supports its Docker deployment in production on Linux only.
Is there managed Mattermost hosting?
Yes. Zenith runs Mattermost Team Edition with PostgreSQL on an HTTPS address for $20 a month, with 10 GB for uploaded files.