Step-by-step guide to install Zabbix in Docker on CentOS 10

From wiki.baghirzade.pro
Jump to navigation Jump to search

Prerequisites & assumptions

  • You have a CentOS 10 (or CentOS Stream 10) system with root or sudo access.
  • Docker (or Podman / container runtime) is installed and working.
  • You have adequate resources (CPU, RAM, disk) for running server + database + web UI.
  • Basic familiarity with Docker, networking, and firewall.

Step 1: Install Docker (or container engine)

If Docker is not yet installed, you can install it with:

sudo dnf update -y
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io
sudo systemctl enable --now docker

You can test with docker version or docker info.

If you prefer using Podman or another container engine, many steps will be similar — but command names differ.

Step 2: Decide database backend & Zabbix components

Zabbix in Docker is typically split into multiple containers:

  • A database container (MySQL / MariaDB or PostgreSQL)
  • The Zabbix server container
  • The Zabbix web frontend (Apache or Nginx) container
  • Optionally: Java Gateway, SNMP trap container, Zabbix agent(s)

The official Zabbix Docker images support various combinations. Zabbix+1

In particular, the zabbix/zabbix-server-mysql image exists for MySQL-backed setups.

Step 3: Use Docker Compose (recommended) or manual docker run

Option A: Use Docker Compose (preferred for easier management)

The Zabbix project maintains a “zabbix-docker” repository with sample compose files. Zabbix

You can clone it:

cd /opt
git clone https://github.com/zabbix/zabbix-docker.git
cd zabbix-docker
# checkout a stable version if you want, e.g. "git checkout 7.4"

Choose a Compose file according to your preferred stack, e.g.:

  • docker-compose_v3_alpine_mysql_latest.yaml
  • or files for PostgreSQL support
  • or docker-compose_v3_ol_mysql_latest.yaml (for Oracle / RHEL style) Zabbix

Then:

docker compose -f docker-compose_v3_alpine_mysql_latest.yaml up -d

This will pull all required images, set up containers, networks, volumes. The documentation shows environment variables and volume paths.

Option B: Manual docker run commands

If you prefer to run each container manually, here’s a minimal example (MySQL backend):

  1. Create a Docker network:
docker network create zabbix-net

2. Run MySQL container (example):

docker run --name mysql-server \

 -e MYSQL_DATABASE="zabbix" \
 -e MYSQL_USER="zabbix" \
 -e MYSQL_PASSWORD="zabbix_pwd" \
 -e MYSQL_ROOT_PASSWORD="root_pwd" \
 --network zabbix-net \
 --restart unless-stopped \
 -d mysql:8.0 \
 --character-set-server=utf8 --collation-server=utf8_bin --default-authentication-plugin=mysql_native_password

3. Run Zabbix server container:

docker run --name zabbix-server-mysql \

 -e DB_SERVER_HOST="mysql-server" \
 -e MYSQL_DATABASE="zabbix" \
 -e MYSQL_USER="zabbix" \
 -e MYSQL_PASSWORD="zabbix_pwd" \
 -e MYSQL_ROOT_PASSWORD="root_pwd" \
 --network zabbix-net \
 -p 10051:10051 \
 --restart unless-stopped \
 -d zabbix/zabbix-server-mysql:latest

4. Run Zabbix web frontend (Nginx + MySQL example):

docker run --name zabbix-web-nginx-mysql \

 -e ZBX_SERVER_HOST="zabbix-server-mysql" \
 -e DB_SERVER_HOST="mysql-server" \
 -e MYSQL_DATABASE="zabbix" \
 -e MYSQL_USER="zabbix" \
 -e MYSQL_PASSWORD="zabbix_pwd" \
 -e MYSQL_ROOT_PASSWORD="root_pwd" \
 --network zabbix-net \
 -p 80:8080 \
 --restart unless-stopped \
 -d zabbix/zabbix-web-nginx-mysql:latest

5. (Optional) Run Java gateway, SNMP trap containers similarly if needed.

6. You can also run agent containers on the same host or on other hosts to monitor them.

Step 4: Configure firewall, SELinux (if applicable)

You need to open required ports on the host:

  • 10051/tcp (Zabbix server)
  • 80/tcp (web interface) (or whichever port you expose)
  • Optionally 10050/tcp (agent) Mike Polinowski+1

Example firewall commands:

firewall-cmd --add-port=10051/tcp --permanent
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd reload

If SELinux is enabled, you may need to adjust policies or disable it for container volumes. (In many Docker setups, SELinux can interfere with volume mounts.)

Step 5: Verify & access the web frontend

Once containers are running:

  • Check with docker ps that all containers (database, server, web UI) are up
  • Check logs (docker logs <container>) if any containers crash
  • In your browser, go to http://<your-server-ip>:80 (or whatever port mapping you used) — you should see the Zabbix frontend installation page
  • Use default credentials: Admin / zabbix (you should change it)

Step 6: Post-installation steps & persistence

  • Persist database and configuration via Docker volumes so that data is not lost on container restart
  • Backup your database regularly
  • Tune resource limits (CPU, memory)
  • Configure Zabbix agents on other hosts to point to your Zabbix server
  • Secure the web UI (SSL, strong passwords, firewall rules)