Home > Software > How to Integrate Mattermost with Docker Compose: A Step-by-Step Guide

How to Integrate Mattermost with Docker Compose: A Step-by-Step Guide

Anastasios Antoniadis

Learn to deploy Mattermost efficiently with our step-by-step guide on setting up a scalable and manageable team communication platform using Docker Compose. Simplify your deployment process and enhance team collaboration today.

Docker (1)

In the fast-paced world of software development and team collaboration, tools like Mattermost have become indispensable. Mattermost offers a flexible, open-source messaging platform that enables teams to communicate securely and efficiently. When combined with Docker, a leading platform for deploying containerized applications, Mattermost’s deployment becomes even more scalable and manageable. This guide provides a comprehensive example of deploying Mattermost using Docker Compose, ensuring you can get your team’s communication hub up and running with minimal hassle.

Why Docker Compose?

Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services, networks, and volumes. This simplifies the deployment process and ensures consistency across different environments, making it an ideal choice for deploying Mattermost.


Before we dive into the Docker Compose file, ensure you have the following installed:

  • Docker
  • Docker Compose

Step 1: Create the Docker Compose File

Create a file named docker-compose.yml in your preferred directory. This file will define the Mattermost server and a PostgreSQL database as services, as Mattermost requires a database to store its data.

version: '3'

    image: postgres:12
      - ./volumes/db:/var/lib/postgresql/data
      - POSTGRES_USER=mmuser
      - POSTGRES_PASSWORD=mmuser_password
      - POSTGRES_DB=mattermost
    restart: unless-stopped

    image: mattermost/mattermost-team-edition
      - ./volumes/app/mattermost/data:/mattermost/data
      - ./volumes/app/mattermost/logs:/mattermost/logs
      - ./volumes/app/mattermost/config:/mattermost/config
      - ./volumes/app/mattermost/plugins:/mattermost/plugins
      - ./volumes/app/mattermost/client-plugins:/mattermost/client/plugins
      - MM_USERNAME=mmuser
      - MM_PASSWORD=mmuser_password
      - MM_DBNAME=mattermost
      - DB_HOST=db
      - db
      - "8065:8065"
    restart: unless-stopped

Explanation of Docker Compose Components

  • version: Specifies the Docker Compose file version. We’re using version 3, which is suitable for most use cases.
  • services: Defines two services, db for the PostgreSQL database, and app for the Mattermost server.
  • image: Specifies the Docker image to use for each service. We use the official postgres:12 and mattermost/mattermost-team-edition images.
  • volumes: Maps directories on your host to the container, ensuring data persistence across container restarts.
  • environment: Sets environment variables required by the services. For Mattermost, we define the database credentials and the database host (linked to the db service).
  • depends_on: Ensures that the db service is started before the app service.
  • ports: Maps ports on your host to the container, allowing you to access the Mattermost server via localhost:8065.

Step 2: Deploying with Docker Compose

With the docker-compose.yml file ready, deploying your Mattermost server is straightforward. Open a terminal, navigate to the directory containing your Docker Compose file, and run:

docker compose up -d

This command will download the necessary Docker images, create the containers, and start the services as defined in your Docker Compose file. The -d flag runs the containers in the background.

Step 3: Accessing Mattermost

Once the containers are up and running, open a web browser and navigate to http://localhost:8065. You should be greeted by the Mattermost setup page, where you can configure your team and admin account.


Deploying Mattermost with Docker Compose simplifies the setup process and enhances the scalability and manageability of your Mattermost server. Following the steps outlined in this guide, you can have a robust, secure team messaging platform ready in minutes, allowing you to focus on what truly matters: effective team collaboration. Whether you’re managing a small team or a large organization, integrating Mattermost with Docker Compose is a powerful solution for your communication needs.

Anastasios Antoniadis
Follow me
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x