How to Deploy Zabbix – Open-Source Monitoring Platform

Zabbix is an open-source monitoring platform that tracks the health and performance of servers, networks, applications, and services. It collects metrics, triggers alerts based on configurable thresholds, and provides dashboards for visualizing infrastructure status. Zabbix supports monitoring through agents, Java Management Extensions (JMX), and custom scripts.
This article explains how to deploy Zabbix using Docker Compose with a MySQL database and a Traefik reverse proxy that provisions an HTTPS certificate through Let's Encrypt.
Prerequisites
Before you begin, you need to:
- Have access to a Linux-based server as a non-root user with sudo privileges.
- Install Docker and Docker Compose.
- Configure a DNS A record pointing to your server's IP address (for example,
zabbix.example.com).
Set Up the Project Directory
The project directory holds the Docker Compose file and environment variables for the deployment.
Create the project directory.
console$ mkdir ~/zabbix-docker
Enter the project directory.
console$ cd ~/zabbix-docker
Create the environment variable file.
console$ nano .env
Add the following variables:
iniDOMAIN=zabbix.example.com LETSENCRYPT_EMAIL=admin@example.com MYSQL_PASSWORD=YOUR_DB_PASSWORD MYSQL_ROOT_PASSWORD=YOUR_ROOT_PASSWORD
Replace the placeholders:
- zabbix.example.com: Your registered domain name.
- admin@example.com: Your email address for Let's Encrypt certificate notifications.
- YOUR_DB_PASSWORD: A strong password for the
zabbixdatabase user. - YOUR_ROOT_PASSWORD: A strong password for the MySQL root account.
Save and close the file.
Deploy with Docker Compose
The Compose file defines the Traefik reverse proxy, the Zabbix Server, the Zabbix web frontend, the MySQL database, and the Zabbix Agent.
Add your user to the
dockergroup to run Docker commands withoutsudo.console$ sudo usermod -aG docker $USER
Apply the group change to your current session.
console$ newgrp docker
Create the Docker Compose file.
console$ nano docker-compose.yaml
Add the following configuration:
yamlservices: traefik: image: traefik:v3.6 container_name: traefik restart: unless-stopped command: - "--providers.docker=true" - "--providers.docker.exposedbydefault=false" - "--entrypoints.web.address=:80" - "--entrypoints.websecure.address=:443" - "--entrypoints.web.http.redirections.entrypoint.to=websecure" - "--entrypoints.web.http.redirections.entrypoint.scheme=https" - "--certificatesresolvers.le.acme.httpchallenge=true" - "--certificatesresolvers.le.acme.httpchallenge.entrypoint=web" - "--certificatesresolvers.le.acme.email=${LETSENCRYPT_EMAIL}" - "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json" ports: - "80:80" - "443:443" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./letsencrypt:/letsencrypt networks: - zabbix-net mysql-server: image: mysql:8.4.8 container_name: zabbix-mysql environment: MYSQL_DATABASE: zabbix MYSQL_USER: zabbix MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} volumes: - ./mysql-data:/var/lib/mysql networks: - zabbix-net restart: unless-stopped zabbix-server: image: zabbix/zabbix-server-mysql:7.4.8-alpine container_name: zabbix-server environment: DB_SERVER_HOST: mysql-server MYSQL_DATABASE: zabbix MYSQL_USER: zabbix MYSQL_PASSWORD: ${MYSQL_PASSWORD} MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} ports: - "10051:10051" volumes: - ./zabbix-server-data:/var/lib/zabbix networks: - zabbix-net depends_on: - mysql-server restart: unless-stopped zabbix-web: image: zabbix/zabbix-web-apache-mysql:7.4.8-alpine container_name: zabbix-web environment: DB_SERVER_HOST: mysql-server MYSQL_DATABASE: zabbix MYSQL_USER: zabbix MYSQL_PASSWORD: ${MYSQL_PASSWORD} ZBX_SERVER_HOST: zabbix-server PHP_TZ: UTC networks: - zabbix-net depends_on: - mysql-server - zabbix-server restart: unless-stopped labels: - "traefik.enable=true" - "traefik.http.routers.zabbix.rule=Host(`${DOMAIN}`)" - "traefik.http.routers.zabbix.entrypoints=websecure" - "traefik.http.routers.zabbix.tls=true" - "traefik.http.routers.zabbix.tls.certresolver=le" - "traefik.http.services.zabbix.loadbalancer.server.port=8080" zabbix-agent: image: zabbix/zabbix-agent:7.4.8-alpine container_name: zabbix-agent environment: ZBX_HOSTNAME: "Zabbix server" ZBX_SERVER_HOST: zabbix-server ports: - "10050:10050" networks: - zabbix-net depends_on: - zabbix-server restart: unless-stopped networks: zabbix-net: driver: bridge
Save and close the file.
The configuration defines the following services:
traefik: Handles all external web traffic on ports 80 and 443. It provisions and renews TLS certificates from Let's Encrypt and routes HTTPS requests to the Zabbix web interface using Docker labels.mysql-server: Runs MySQL 8.4 and stores all Zabbix configuration and monitoring data. Database credentials are read from the.envfile.zabbix-server: Collects metrics from agents, processes data, and evaluates alert triggers.zabbix-web: The Apache-based web frontend. Traefik routes HTTPS traffic from${DOMAIN}to port 8080 on this container.zabbix-agent: Monitors the local host and sends metrics tozabbix-server.
Start all services in detached mode.
console$ docker compose up -d
Verify that all containers are running.
console$ docker compose ps
The output displays five running containers: Traefik, MySQL, Zabbix Server, Zabbix Web, and Zabbix Agent.
Access the Zabbix Web Interface
The Zabbix web interface is accessible at the domain configured in the .env file after Traefik provisions the TLS certificate.
Open a web browser and navigate to the Zabbix web interface. Replace
zabbix.example.comwith the domain you set inDOMAIN.https://zabbix.example.comLog in using the default credentials.
- Username:
admin - Password:
zabbix

The Zabbix Global view dashboard loads after a successful login. It displays host availability, top hosts by CPU usage, system information, and any active alerts.
- Username:
Change the default admin password. Expand Users in the left sidebar and click Users.
Click Admin in the user list to open the user edit page.
Click the Change password button next to the Password field.
The page reveals the Current password, Password, and Password (once again) fields.
Enter
zabbixin the Current password field.Enter a new secure password in the Password and Password (once again) fields.
Click Update to save the new password.
Verify Zabbix Is Running
Confirm that Zabbix is collecting data from the configured agent.
Navigate to Monitoring > Hosts from the left sidebar.
Check the
ZBXavailability badge for theZabbix serverhost.In Docker deployments, this badge appears red by default because Zabbix attempts to reach the agent at
127.0.0.1:10050— the server container's own loopback address, not the agent container's address. The next step fixes this.
Update the agent interface to use the Docker service name instead of the loopback address.
- Click the host name Zabbix server in the Hosts list. A context menu appears.
- Under CONFIGURATION, click Host. The Host configuration dialog opens.
- In the Interfaces section, locate the Agent row. Change the Connect to option from IP to DNS and enter
zabbix-agentin the DNS name field. - Click Update.
The Hosts page displays a Host updated confirmation banner.
Refresh the Hosts page after a few moments. The
ZBXbadge turns green, confirming the agent is connected and sending data to the server.
Navigate to Monitoring > Latest data to view real-time metrics.
In the Hosts field, type
Zabbix server, select it from the results, then click Apply.CPU usage, memory consumption, and network traffic metrics appear in the list, confirming that Zabbix is collecting data from the agent.
Navigate to Dashboard to view the default dashboard. The dashboard shows one host available with a green status, confirming the monitoring setup is complete.

Conclusion
You have successfully deployed Zabbix on your Linux server using Docker Compose with Traefik providing automatic HTTPS through Let's Encrypt. The Zabbix Agent monitors the local host and reports CPU usage, memory consumption, and network traffic to the Zabbix Server. For more information, visit the official Zabbix documentation.