🐳 Matomo (formerly Piwik) Docker image based on Alpine Linux and Nginx.
If you are interested, check out my other 🐳 Docker images!
- Alpine Linux 3.7, Nginx, PHP 7.1
- Tarball authenticity checked during building process
- Config, plugins and user preferences in the same folder
- GeoLite data created by MaxMind for geolocation
- Cron tasks to archive Matomo reports and update GeoLite data
- Plugins and config are kept across upgrades of this image
- SSMTP for SMTP relay to send emails
- OPCache enabled to store precompiled script bytecode in shared memory
- Redis enabled and ready to enhance server performance
- Reverse proxy with nginx-proxy
- Creation/renewal of Let's Encrypt certificates automatically with letsencrypt-nginx-proxy-companion
- Redis image ready to use as Redis cache or QueuedTracking plugin for better scalability
- MariaDB image as database instance
TZ
: The timezone assigned to the container (default toUTC
)SITE_URL
: Your Matomo site URLCRON_GEOIP
: Periodically update GeoIP data (disabled if empty)CRON_ARCHIVE
: Periodically execute Matomo archive (disabled if empty)LOG_LEVEL
: Log level of Matomo UI (default toWARN
)MEMORY_LIMIT
: PHP memory limit (default to256M
)UPLOAD_MAX_SIZE
: Upload max size (default to16M
)OPCACHE_MEM_SIZE
: PHP OpCache memory consumption (default to128
)SSMTP_HOST
: SMTP server hostSSMTP_PORT
: SMTP server port (default to25
)SSMTP_HOSTNAME
: Full hostname (default to$(hostname -f)
)SSMTP_USER
: SMTP usernameSSMTP_PASSWORD
: SMTP passwordSSMTP_TLS
: SSL/TLS (default toNO
)
/data
: Contains config folder, installed plugins (not core ones), tmp folder and user folder to store your custom logo
80
: HTTP port
Docker compose is the recommended way to run this image. You can use the following docker compose template. Edit this file with your preferences, then run :
docker-compose up -d
docker-compose logs -f
Or use the following minimal command :
docker run -d -p 80:80 --name matomo \
-e TZ="Europe/Paris" \
-e SITE_URL="https://matomo.example.com" \
-v $(pwd)/data:/data \
crazymax/matomo:latest
If you have enabled CRON_ARCHIVE
to automatically archive the reports, you have to disable Matomo archiving to trigger from the browser. Go to System > General settings :
As GeoIP module for Nginx is installed and uses GeoIP data, you have to select GeoIP (HTTP Server Module) in System > Geolocation :
If you are running Matomo behind a reverse proxy, add this to your config.ini.php :
[General]
assume_secure_protocol = 1 # 0=http 1=https
proxy_client_headers[] = HTTP_X_FORWARDED_FOR
proxy_client_headers[] = HTTP_X_REAL_IP
proxy_host_headers[] = HTTP_X_FORWARDED_HOST
To use Redis as a cache (useful if your Matomo environment consists of multiple servers), add this to your config.ini.php :
[Cache]
backend = chained
[ChainedCache]
backends[] = array
backends[] = redis
[RedisCache]
host = "redis" # Docker service name for Redis
port = 6379
timeout = 0.0
password = ""
database = 14
In case you are using queued tracking: Make sure to configure a different database! Otherwise queued requests will be flushed.
You can upgrade Matomo automatically through the UI, it works well. But i recommend to recreate the container whenever i push an update :
docker-compose pull
docker-compose up -d
All kinds of contributions are welcomed 🙌!
The most basic way to show your support is to star 🌟 the project, or to raise issues 💬
But we're not gonna lie to each other, I'd rather you buy me a beer or two 🍻!
MIT. See LICENSE
for more details.