Bookmark

Run Mattermost in Docker: Compose, PostgreSQL, and Workspace Initialization

Mattermost is a self-hosted collaboration platform. The i12bretro tutorial uses the official Docker repository, an .env file, PostgreSQL, and a compose profile without Nginx; I retain all 12 numbered actions and replace the sample password with [REDACTED].1

Youtube video player

The original video title and author were checked with oEmbed and the video is embedded directly.2

1. Install Docker on Linux

Step 1/12: Log into the Linux device.

Step 2/12: Install the prerequisites and Docker:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# install prerequisites
sudo apt install apt-transport-https ca-certificates git curl software-properties-common gnupg-agent -y
# add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
# add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
# install docker
sudo apt install docker-ce docker-compose containerd.io -y
# enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
# add the current user to the docker group
sudo usermod -aG docker $USER
# reauthenticate for the new group membership to take effect
su - $USER

2. Clone the repository and prepare .env

Step 3/12: Once Docker is installed, prepare Mattermost:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# clone git repo
git clone https://github.com/mattermost/docker ~/docker/mattermost
# create working directories
mkdir ~/docker/mattermost/{config,data,logs,plugins,client/plugins,bleve-indexes} -p
# create a copy of .env
cp ~/docker/mattermost/env.example ~/docker/mattermost/.env
# set owner of working directories
sudo chown "$USER":"$USER" ~/docker -R
# allow the container to write to working directories
sudo chmod a+rwx -R ~/docker/mattermost
# replace default paths
sudo sed -i "s|/volumes||" ~/docker/mattermost/.env
# edit .env
nano ~/docker/mattermost/.env

Step 4/12: Change at least these .env values:

1
2
3
4
DOMAIN=ubuntuserver.local
TZ=America/New_York
POSTGRES_USER=mattermost_rw
POSTGRES_PASSWORD=[REDACTED]

The domain, timezone, and database password are source examples; replace the domain/timezone and create a new local password.

Step 5/12: Press CTRL+O, Enter, CTRL+X to write the changes to .env.

3. Start Mattermost

Step 6/12: Start compose from the Mattermost directory:

1
2
3
4
# cd to matter most directory
cd ~/docker/mattermost
# run mattermost container
sudo docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d

Step 7/12: Open:

1
http://DNSorIP:8065

Replace DNSorIP with the host address; do not expose the service to the Internet without TLS and authentication.

Step 8/12: Click View in Browser.

Step 9/12: Complete the account-creation form.

Step 10/12: Enter an Organization Name, then click Continue.

Step 11/12: Complete the remaining prompts or choose to skip them.

Step 12/12: The Mattermost welcome page running in Docker appears.

4. Checks after the wizard

1
2
3
cd ~/docker/mattermost
sudo docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml ps
sudo docker compose -f docker-compose.yml -f docker-compose.without-nginx.yml logs --tail=100

Back up config, data, logs, plugins, client/plugins, bleve-indexes, and .env outside Git. The source also links Mattermost's official Docker installation documentation; consult it again when the image or compose files change.1

Conclusion

The tutorial's 12-step path is short: install Docker, clone the repository, create persistent directories, edit four .env values, run the no-Nginx compose profile, and finish the port 8065 wizard. Real passwords belong in local secret storage; reverse proxy, TLS, backups, and image-update policy are required before production use.

Sources


  1. i12bretro tutorial 0889 – Mattermost - Secure Collaboration Platform - in Docker , revised 2025-01-14. Independently edited from the numbered HTML page; the sample password is replaced with [REDACTED]↩︎ ↩︎

  2. YouTube – Run Mattermost - Secure Collaboration Platform - in Docker — i12bretro video, validated with oEmbed. ↩︎


0 Bình luận

Góp Ý / Bình Luận / Đánh giá