29 C
Guru Unix /Linux and GNU supporter

Centos7 and 8 uses docker-compose to install zabbix

Build and run a zabbix system through docker’s basic operation command, which involves zabbix-server, zabbix-web-Nginx-mysq, and mysql container. Operation up relatively tedious, and every time to run to come again is very inconvenient. Here’s how to deploy zabbix with a docker-compose

Install Docker and Docker-compose

The first thing to do is to install Docker and Docker compose in our system. For centos7, use the following command.

For the rest of the releases, it’s best to read the official Docker documentation.

- Advertisement -
[[email protected] ~]# yum install docker python-pip docker-compose -y

Check that the installation is successful

 [[email protected] ~]# docker-compose -v && docker -v
Check docker and docker-compose
Check docker and docker-compose

Deploy zabbix using Docker-compose

  • First, create a folder and then create docker-compose.yml files in it
[[email protected] ~]# mkdir zabbix
[[email protected] ~]# cd zabbix/
[[email protected] zabbix]# touch docker-compose.yml
  • Edit docker-compose.yml file
[[email protected] zabbix]# vim docker-compose.yml 
 version: '3'
     image: mysql:5.6
     container_name: zabbix-mysql
       - '3306:3306'
       MYSQL_ROOT_PASSWORD: zabbix
       - /root/zabbix/mysql-data:/var/lib/mysql
     image: zabbix/zabbix-server-mysql:ubuntu-3.0.4
     container_name: zabbix-server
       DB_SERVER_HOST: "zabbix-mysql"
       MYSQL_USER: root
       MYSQL_PASSWORD: zabbix
       - '10051:10051'
       - zabbix-mysql
       - zabbix-mysql
     image: zabbix/zabbix-web-nginx-mysql:ubuntu-3.0.4
     container_name: zabbix-web
       DB_SERVER_HOST: zabbix-mysql
       MYSQL_USER: root
       MYSQL_PASSWORD: zabbix
       ZBX_SERVER_HOST: "zabbix-server"
       PHP_TZ: Asia/Shanghai
       - '80:80'
       - '443:443'
       - zabbix-mysql
       - zabbix-server
       - zabbix-mysql
       - zabbix-server

Important environment variable Settings

  • Zabbix-web-nginx-mysql and zabbix-web-nginx-mysql image versions remain consistent (ubuntu-3.0.4 or other)
  • MYSQL_ROOT_PASSWORD: mysql root password
  • MYSQL_USER: Connect the mysql user
  • MYSQL_PASSWORD: Connect the mysql password

Running and testing zabbix

[[email protected] ~]# docker-compose up -d
[[email protected] ~]# docker-compose ps
Deploy zabbix using docker-compose
Deploy zabbix using docker-compose

Wait 2 minutes for the database initialization to complete

Next, open your web browser and go to your server using the port 80.

zabbix login
zabbix login

Log in using Zabbix’s default user and password
user: Admin password:zabbix
After that, you will see the dashboard

zabbix dashboard
zabbix dashboard

In a nutshell with Docker Compose, you no longer need to use shell scripts to start the container. In the configuration file, all containers are defined through the services, and then the application is started, stopped, and restarted using the docker-compose script, along with the services in the application and all containers that depend on the services. Docker Compose is a tool for defining and running multi-container Docker applications. it USES YAML files to configure the service of the application and a single command to perform the creation and startup of all containers. The docker-compose cli tool allows users to run commands for multiple containers simultaneously.

android (169) Apache (56) bionic (55) Buster (83) CentOS (145) Centos 8 (51) database (57) Databases (62) debian (171) desktop (34) fedora (50) focal (102) Focal Fossa (106) google (94) howto (346) How to (330) how to tutorials (39) java (50) Linux (862) linux mint (37) mariadb (48) monitoring (36) mysql (43) network (35) News (59) New version (64) opensuse (44) PHP (66) Programming (139) RHEL (47) Security (92) server (259) SQL (65) tools (52) Tutorial (485) ubuntu (282) unix (32) web (40) web server (33) Windows (280) Windows 10 (217) windows 11 (52) Windows server (46) Windows server 2019 (58) windows update (31)


  1. If you’re getting an error like this ”

    Invalid top-level property “zabbix-web”. Valid top-level sections for this Compose file are: version, services, networks, volumes, secrets, configs, and extensions starting with “x-“.


    Remove double spaces before zabbix-web and zabbix-server. Indentation is wrong within the example. They should be under “services”.


Please enter your comment!
Please enter your name here

Latest article