Simplified Docker Compose configuration for running Zabbix monitoring system with Grafana dashboards
For those who are used to using zabbix to collect metrics, but want to start drawing dashboards more beautifully
Example simple docker-compose service
Current versions:
- Zabbix Server: 7.4
- PostgreSQL: 18-alpine
- Grafana: 13.2
Image tags live in .env and float within a major version. Run docker compose pull before
docker compose up -d to actually pick up patch releases — a floating tag that is already cached
locally is reused as-is. PostgreSQL 18 requires Zabbix 7.4.4 or newer.
git clone https://github.com/akmalovaa/zabbix-docker.git
cd zabbix-dockerReview and modify the .env file if needed:
cp .env .env.local # Optional: create local copy
nano .env # Edit configurationdocker compose up -d⏱️ First launch takes 1-2 minutes while PostgreSQL initializes and Zabbix server starts.
Check if all services are running:
docker compose psKey variables in .env file:
| Variable | Default | Description |
|---|---|---|
POSTGRES_USER |
zabbix |
PostgreSQL username |
POSTGRES_PASSWORD |
zabbix |
PostgreSQL password |
POSTGRES_DB |
zabbix |
Database name |
GRAFANA_USER |
admin |
Grafana admin username (becomes GF_SECURITY_ADMIN_USER) |
GRAFANA_SECRET |
12345 |
Grafana admin password (becomes GF_SECURITY_ADMIN_PASSWORD) |
ZABBIX_API_USER |
Admin |
Zabbix account the Grafana datasource logs in with |
ZABBIX_API_PASSWORD |
zabbix |
Password for that account |
TZ |
Asia/Yekaterinburg |
Timezone for all services |
⚠️ Security Note: Change default passwords in production!
| Service | Internal Port | External Port | URL |
|---|---|---|---|
| Zabbix Frontend | 8080 | 8080 | YOUR_HOST:8080 |
| Grafana | 3000 | 3000 | YOUR_HOST:3000 |
| Zabbix Agent | 10050 | 10050 | (used internally) |
| Zabbix Server | 10051 | 10051 | (used internally) |
| PostgreSQL | 5432 | 5432 | Published on the host - drop the mapping in compose.yaml to keep it internal |
| zabbix-init | - | - | One-shot, exits after configuring the agent interface |
URL: localhost:8080
Default Credentials:
- Username:
Admin - Password:
zabbix
Nothing to do - the zabbix-init one-shot service handles this on docker compose up -d.
The bundled Zabbix server host ships from the schema import with a hardcoded 127.0.0.1
agent interface, which inside Docker points at the server container's own loopback instead of
the agent. Every agent item then fails with
Cannot establish TCP connection to [[127.0.0.1]:10050]. On startup zabbix-init calls the
Zabbix API and repoints that interface at the DNS name zabbix-agent. It is idempotent, so it
is a no-op on every subsequent start.
The Zabbix server caches host configuration, so metrics start arriving within a minute. To avoid the wait:
docker compose exec zabbix-server zabbix_server -R config_cache_reloadDoing it by hand instead
- Navigate to Data collection → Hosts
- Click on Zabbix server host
- Go to Interfaces tab
- Change Connect to from IP to DNS
- Set DNS name to
zabbix-agent - Update the host
URL: localhost:3000
Default Credentials:
- Username:
admin - Password:
12345
💡 Anonymous access is enabled by default (see
grafana/grafana.ini)
- Go to Connections → Data sources
- Select Zabbix data source
- Click Test button
- Should show "Data source is working"
# All services
docker compose logs --tail=10 -f
# Specific service
docker compose logs -f zabbix-server
docker compose logs -f postgres# Check database connection
docker compose logs zabbix-server
# Restart services in order
docker compose restart postgres
sleep 30
docker compose restart zabbix-server# Check if ports are available
netstat -tulpn | grep -E ':(8080|3000|10051|10050)'
# Check container status
docker compose ps# Verify Zabbix API is accessible
curl -X POST http://localhost:8080/api_jsonrpc.php \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"apiinfo.version","id":1}'For better performance with large datasets:
# Add to zabbix-server environment in compose.yaml
ZBX_CACHESIZE: "128M"
ZBX_CACHEUPDATEFREQUENCY: "60"
ZBX_STARTDBSYNCERS: "4"- Change default passwords in
.env - Use strong database passwords
- Restrict access to ports (use firewall/security groups)
- Enable HTTPS for Zabbix frontend
- Configure proper backup strategy



