Zabbix is an open-source monitoring platform that tracks the health and performance of servers, networks, applications, and services, with built-in alerting and visualisation. This guide deploys the Zabbix server, web UI, agent, and MySQL database using Docker Compose, with Traefik handling automatic HTTPS for the dashboard. By the end, you'll have Zabbix monitoring its own host with a secured dashboard at your domain.
Set Up the Project Directory
1. Create the project directory:
$ mkdir ~/zabbix-docker
$ cd ~/zabbix-docker
2. Create the environment file:
$ nano .env
DOMAIN=zabbix.example.com
LETSENCRYPT_EMAIL=admin@example.com
MYSQL_PASSWORD=YOUR_DB_PASSWORD
MYSQL_ROOT_PASSWORD=YOUR_ROOT_PASSWORD
Deploy with Docker Compose
1. Add your user to the Docker group:
$ sudo usermod -aG docker $USER
$ newgrp docker
2. Create the Compose manifest:
$ nano docker-compose.yaml
services:
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
3. Start the stack:
$ docker compose up -d
$ docker compose ps
Sign In and Change the Admin Password
- Open
https://zabbix.example.com. - Sign in with
admin/zabbix. - Open Users → Users, click Admin, click Change password, enter the current password, set a new one, and click Update.
Verify the Built-in Host
- Navigate to Monitoring → Hosts.
- Find Zabbix server in the list and check the
ZBXavailability badge. - If the badge is red, click the host name, open Configuration → Host, change the agent Connect to field from IP to DNS, enter
zabbix-agentin the DNS name field, and click Update. - Refresh — the badge should turn green.
- Open Monitoring → Latest data, filter by host
Zabbix server, and confirm CPU, memory, and network metrics arrive.
Next Steps
Zabbix is running and served securely over HTTPS. From here you can:
- Add more hosts by deploying the Zabbix agent on remote servers and registering them
- Import community templates for common workloads (PostgreSQL, Nginx, MySQL, Linux)
- Configure media types (email, Slack, PagerDuty) and triggers for alerting
For the full guide with additional tips, visit the original article on Vultr Docs.
Top comments (0)