Deploy Zabbix with Docker: A Quick Start Guide

Looking for a fast and reliable way to get Zabbix up and running locally? This guide shows you how to deploy Zabbix using Docker and Docker Compose, ideal for testing, learning, or small-scale monitoring setups.

If you're new to Zabbix or just want a hassle-free installation method, follow these simple steps to spin up a fully working Zabbix monitoring environment in containers.

Why Use Docker for Zabbix?

Docker provides a lightweight, consistent, and isolated environment—perfect for running tools like Zabbix without the complexity of manual installation. With Docker Compose, you can define and manage your Zabbix stack using a single configuration file.

Step-by-Step Instructions

1. Create Your Docker Compose File

Create a file named docker-compose.yaml and paste the code provided at the end of this article into it.

2. Prepare the Database Folder

In the same directory, create a folder named mysqldata. This folder will store MySQL data files used by Zabbix.

đź”’ Why not use Docker volumes? Keeping files in a visible directory makes backups easier and keeps your entire Zabbix project self-contained.

3. Set Proper Permissions

Make sure the mysqldata folder is writable by all users (e.g., chmod 777 mysqldata). Otherwise, the database container may fail to start.

  1. Start the containers by running:
docker compose up -d

Docker compose file

Copy the code bellow, or just download the file from here

services:
  # Zabbix Server
  zabbix-server:
    restart: always
    image: zabbix/zabbix-server-mysql:alpine-7.0-latest
    container_name: zabbix-server
    depends_on:
      - database
    environment:
      DB_SERVER_HOST: database
      DB_SERVER_PORT: 3306
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: dbpassword
      MYSQL_DATABASE: zabbix
    ports:
      - "10051:10051"
    networks:
      - zabbix-network
  # Database
  database:
    restart: always
    image: mariadb:latest
    container_name: zabbix-db
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: zabbix
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: dbpassword
    volumes:
    - ./mysqldata:/var/lib/mysql
    networks:
    - zabbix-network
  # Zabbix Web Frontend
  zabbix-frontend:
    restart: always
    image: zabbix/zabbix-web-nginx-mysql:alpine-7.0-latest
    container_name: zabbix-frontend
    environment:
      DB_SERVER_HOST: database
      DB_SERVER_PORT: 3306
      MYSQL_USER: zabbix
      MYSQL_PASSWORD: dbpassword
      MYSQL_DATABASE: zabbix
      ZBX_SERVER_HOST: zabbix-server
    depends_on:
      - zabbix-server
    volumes:
      - ./modules:/usr/share/zabbix/modules
    ports:
      - "8888:8080"
    networks:
      - zabbix-network

networks:
  zabbix-network: