Self-hosted Matomo stack using Docker Compose with MariaDB.
This setup provides a minimal, production-ready structure.
Create a .env file from .env-sample and fill in the variables.
MARIADB_HOST=db
MARIADB_ROOT_PASSWORD=
MARIADB_USER=
MARIADB_PASSWORD=
MARIADB_DATABASE=
The file db/my.cnf is mounted into:
/etc/mysql/conf.d/matomo.cnf
Do not add !includedir directives, since the base MariaDB container configuration already manages these.
Two Docker volumes are created:
| Volume | Purpose |
|---|---|
db |
MariaDB database files |
matomo |
Matomo application data |
These volumes ensure data survives container restarts.
Pull the latest images:
docker compose pull
docker compose up -d
Important
Do a database backup before upgrading.
Purge builder's cache:
sudo docker builder prune -achmod +x infra/deploy-service.sh
sudo ./infra/deploy-service.sh
systemctl status docker-matomo
ss -tlnp | grep 8983