Mattermost logo

Mattermost

Team communication and collaboration platform

Alternative to: Slack, Microsoft Teams, Discord


Mattermost is the AI-powered collaborative workflow for defense, intelligence, security & critical infrastructure enterprises.

Mattermost Docker Compose example

Self-host Mattermost on your own server, homelab, or VPS starting from this Docker Compose example. It runs Mattermost in Docker containers using the official mattermost/mattermost-team-edition:latest, postgres:13-alpine images, with persistent volumes and automatic restarts preconfigured. Review the environment variables and adjust them to your setup, save the file as compose.yml (or docker-compose.yml), and start the stack with docker compose up -d.

services:
  mattermost:
    image: mattermost/mattermost-team-edition:latest
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    pids_limit: 200
    tmpfs:
      - /tmp
    volumes:
      - config:/mattermost/config:rw
      - data:/mattermost/data:rw
      - plugins:/mattermost/plugins:rw
      - client_plugins:/mattermost/client/plugins:rw
      - bleve_indexes:/mattermost/bleve-indexes:rw
    environment:
      # Domain of service
      DOMAIN: "localhost"
      MM_SERVICESETTINGS_SITEURL: "http://localhost"
      # Container settings
      ## Timezone inside the containers. The value needs to be in the form 'Europe/Berlin'.
      ## A list of these tz database names can be looked up at Wikipedia
      ## https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      TZ: "UTC"
      # Mattermost settings
      ## Bleve index (inside the container)
      MM_BLEVESETTINGS_INDEXDIR: "/mattermost/bleve-indexes"
      ## Below one can find necessary settings to spin up the Mattermost container
      POSTGRES_USER: "mmuser"
      POSTGRES_PASSWORD: "mmuser_password"
      POSTGRES_DB: "mattermost"
      MM_SQLSETTINGS_DRIVERNAME: "postgres"
      MM_SQLSETTINGS_DATASOURCE: "postgres://mmuser:mmuser_password@postgres:5432/mattermost?sslmode=disable&connect_timeout=10"
      MM_SUPPORTSETTINGS_SUPPORTEMAIL: "changeme"
    depends_on:
      - postgres

  postgres:
    image: postgres:13-alpine
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    pids_limit: 100
    read_only: true
    tmpfs:
      - /tmp
      - /var/run/postgresql
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      # Domain of service
      DOMAIN: "localhost"
      MM_SERVICESETTINGS_SITEURL: "http://localhost"
      # Container settings
      ## Timezone inside the containers. The value needs to be in the form 'Europe/Berlin'.
      ## A list of these tz database names can be looked up at Wikipedia
      ## https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
      TZ: "UTC"
      # Mattermost settings
      ## Bleve index (inside the container)
      MM_BLEVESETTINGS_INDEXDIR: "/mattermost/bleve-indexes"
      ## Below one can find necessary settings to spin up the Mattermost container
      POSTGRES_USER: "mmuser"
      POSTGRES_PASSWORD: "mmuser_password"
      POSTGRES_DB: "mattermost"
      MM_SQLSETTINGS_DRIVERNAME: "postgres"
      MM_SQLSETTINGS_DATASOURCE: "postgres://mmuser:mmuser_password@postgres:5432/mattermost?sslmode=disable&connect_timeout=10"
      MM_SUPPORTSETTINGS_SUPPORTEMAIL: "changeme"

volumes:
  config:
  data:
  plugins:
  client_plugins:
  bleve_indexes:
  postgres_data:

Values set to changeme are required — replace them with your own values before starting Mattermost.

Prefer a managed setup? WinterFlow installs, configures, and updates Mattermost for you using this same Docker Compose configuration.