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.
[root@localhost ~]# yum install docker python-pip docker-compose -y
Check that the installation is successful
[root@localhost ~]# docker-compose -v && docker -v

Deploy zabbix using Docker-compose
- First, create a folder and then create docker-compose.yml files in it
 
[root@localhost ~]# mkdir zabbix [root@localhost ~]# cd zabbix/ [root@localhost zabbix]# touch docker-compose.yml
- Edit docker-compose.yml file
 
[root@localhost zabbix]# vim docker-compose.yml 
 version: '3'
 services:
   zabbix-mysql:
     image: mysql:5.6
     container_name: zabbix-mysql
     ports:
       - '3306:3306'
     environment:
       MYSQL_ROOT_PASSWORD: zabbix
     volumes:
       - /root/zabbix/mysql-data:/var/lib/mysql
 zabbix-server:
     image: zabbix/zabbix-server-mysql:ubuntu-3.0.4
     container_name: zabbix-server
     environment:
       DB_SERVER_HOST: "zabbix-mysql"
       MYSQL_USER: root
       MYSQL_PASSWORD: zabbix
     ports:
       - '10051:10051'
     links:
       - zabbix-mysql
     depends_on:
       - zabbix-mysql
 zabbix-web:
     image: zabbix/zabbix-web-nginx-mysql:ubuntu-3.0.4
     container_name: zabbix-web
     environment:
       DB_SERVER_HOST: zabbix-mysql
       MYSQL_USER: root
       MYSQL_PASSWORD: zabbix
       ZBX_SERVER_HOST: "zabbix-server"
       PHP_TZ: Asia/Shanghai
     ports:
       - '80:80'
       - '443:443'
     links:
       - zabbix-mysql
       - zabbix-server
     depends_on:
       - 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
[root@localhost ~]# docker-compose up -d [root@localhost ~]# docker-compose ps

Wait 2 minutes for the database initialization to complete
Next, open your web browser and go to your server using the port 80.

Log in using Zabbix’s default user and password 
user: Admin  password:zabbix  
After that, you will see the 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 (260) 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 (168) howto (346) How to (330) how to tutorials (39) java (50) Linux (864) 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 (103) server (259) SQL (65) tools (52) Tutorial (485) ubuntu (282) unix (32) web (40) web server (33) Windows (315) Windows 10 (222) windows 11 (73) Windows server (46) Windows server 2019 (58) Xiaomi (36)



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”.