Zabbix on Docker

Zabbix is an enterprise-class, open-source monitoring and observability platform — agents, SNMP, IPMI, JMX, HTTP checks, and trapper data feeding a single web frontend with templating, triggers, and alerting. This guide deploys the official multi-container stack with Docker Compose: a database backend (MySQL or PostgreSQL), the Zabbix server, and an Nginx-based web frontend, each in its own Alpine container, with optional profiles for the agent, SNMP traps, Java gateway, and web service.

Stack: zabbix-server · zabbix-web-nginx · db (mysql / pgsql)  ·  Optional: agent · snmptraps · java-gateway  ·  OS: Linux
01 — Prerequisites
RequirementNotes
Docker + ComposeDocker Engine v1.12+ and the Compose v2 plugin (v2.24.0 or greater) on the host
git + makegit to clone the official repo; make is optional but enables the convenience targets
Linux serverAny modern distribution; 2 vCPU / 4 GB RAM is a comfortable starting point for a small install
Open ports8080/TCP (web), 10051/TCP (server, for agents and proxies to connect in), 10050/TCP (agent), 162/UDP (SNMP traps, if used)
02 — Clone the Official Repository

Zabbix maintains ready-to-use Compose files in the zabbix-docker repository. Clone it and check out the version branch you want — pinning to a specific release rather than tracking a moving branch keeps upgrades deliberate.

Clone & select a version
git clone https://github.com/zabbix/zabbix-docker.git cd zabbix-docker git checkout 7.4
What's in the repo
zabbix-docker/ ├── compose.yaml ← MySQL / MariaDB stack ├── compose_pgsql.yaml ← PostgreSQL stack ├── .env ← image, port & network variables ├── Makefile ← convenience targets (make up / down) └── env_vars/ ├── .env_db_mysql ← database root / user passwords ├── .env_srv ← Zabbix server tuning └── .env_web ← frontend timezone, etc.
ℹ  The two Compose files differ only in database engine. Pick one and stay with it — compose.yaml for MySQL/MariaDB, compose_pgsql.yaml for PostgreSQL. This guide uses the MySQL file; substitute the PostgreSQL one wherever it appears if you prefer Postgres.
03 — Configure the Environment

Configuration is split across two layers. Compose-level variables in .env control which images, ports, and network ranges are used. Component-level variables in the env_vars/.env_<component> files control how each Zabbix process behaves.

env_vars/.env_db_mysql — set strong passwords
MYSQL_USER=zabbix MYSQL_PASSWORD=StrongUserPasswordHere MYSQL_ROOT_PASSWORD=StrongRootPasswordHere MYSQL_DATABASE=zabbix
env_vars/.env_srv — server tuning (optional)
ZBX_STARTPOLLERS=20 ZBX_CACHESIZE=64M ZBX_STARTDBSYNCERS=4
env_vars/.env_web — frontend timezone
PHP_TZ=Europe/Lisbon ZBX_SERVER_NAME=My Zabbix Server
⚠  Replace every ...PasswordHere placeholder before the first start. The database user password must be consistent across the db, server, and web components — Zabbix wires this for you through the shared env files, so set it once in .env_db_mysql and don't hand-edit copies.
04 — Choose Which Components Run

By default the stack starts a minimal set — server, web frontend, and database — which keeps it lightweight. Additional components are gated behind Compose profiles, so you opt into only what you need. The table lists the common ones.

ComponentRole
zabbix-serverCore engine: collects data, evaluates triggers, sends alerts (always on)
zabbix-webNginx + PHP frontend, published on port 8080 (always on)
dbMySQL/MariaDB or PostgreSQL backing store (always on)
zabbix-agentMonitors the Zabbix host itself; useful as a first test target
zabbix-snmptrapsReceives SNMP traps on 162/UDP for trap-based monitoring
zabbix-java-gatewayAdds JMX monitoring for Java applications
zabbix-web-serviceGenerates scheduled PDF reports from dashboards
ℹ  Profiles are passed at deploy time. Starting with no profile gives you the minimal stack; adding --profile all (or naming individual profiles) pulls in the extras.
05 — Deploy the Stack

Bring everything up with the chosen Compose file. The first start pulls images, builds the internal networks, initialises the database schema, and starts each container in dependency order — this takes a minute or two while the database seeds.

Minimal stack (MySQL)
docker compose -f ./compose.yaml up -d
With agent, traps, Java gateway & web service
docker compose -f ./compose.yaml --profile all up -d
Custom OS base & web ports (inline variables)
OS=ubuntu \ ZABBIX_WEB_NGINX_HTTP_PORT=8282 \ ZABBIX_WEB_NGINX_HTTPS_PORT=8443 \ docker compose -f ./compose.yaml up -d
ℹ  Prefer shortcuts? The bundled Makefile wraps these: make up for the default MySQL stack, or make up DB=pgsql OS=ubuntu for a PostgreSQL-on-Ubuntu build. Run make help to list targets. Whatever you pass to up, pass the same DB= value to down.
06 — Verify the Containers
Check status
docker compose -f ./compose.yaml ps NAME IMAGE STATUS zabbix-docker-server-1 zabbix/zabbix-server-mysql Up zabbix-docker-web-1 zabbix/zabbix-web-nginx-mysql Up zabbix-docker-mysql-1 mysql:8.0 Up
Tail the server log if a container restarts
docker compose -f ./compose.yaml logs -f zabbix-server
Confirm the API answers
curl -X POST http://localhost:8080/api_jsonrpc.php \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"apiinfo.version","id":1}'

A JSON response carrying the version string confirms the frontend and server are wired together correctly.

07 — First Login

Open the web frontend in your browser. On a default deployment it listens on port 8080:

Web frontend
http://your-server-ip:8080
✓  Default credentials: Admin / zabbix (the username is capitalised). Go to Users → Users, open the Admin account, and change the password immediately before doing anything else.
⚠  The default Admin / zabbix login is publicly documented and identical on every fresh install. Leaving it in place is equivalent to publishing your monitoring console's keys — anyone who reaches the URL has full administrative control over hosts, scripts, and alert actions.
08 — Add Your First Host

The simplest first target is the Zabbix host itself via the bundled agent (started with the agent profile). In the UI go to Data collection → Hosts → Create host, give it a name, attach the Linux by Zabbix agent template, and set the interface.

⚠  A common first-run error is cannot connect to [127.0.0.1]:10050. Inside Docker the agent is not on localhost relative to the server — set the host's agent interface to the agent container's name or its IP on the Zabbix network (e.g. zabbix-agent), not 127.0.0.1.

For network devices, add them with an SNMP interface instead of an agent interface, attach a matching SNMP template, and supply the community string or SNMPv3 credentials. After a few collection cycles the host's availability indicator turns green and data begins populating.

09 — Key Commands
TaskCommand
Start stackdocker compose -f ./compose.yaml up -d
Stop stackdocker compose -f ./compose.yaml down
View logs (live)docker compose -f ./compose.yaml logs -f zabbix-server
Check statusdocker compose -f ./compose.yaml ps
Reload server config cachedocker compose exec zabbix-server zabbix_server -R config_cache_reload
Test agent reachabilitydocker compose exec zabbix-server zabbix_get -s zabbix-agent -k system.uptime
Makefile shortcut (up)make up
Upgradegit pull && docker compose -f ./compose.yaml pull && docker compose -f ./compose.yaml up -d