1、编写docker-comper文件
vim zabbix.yml
version: "3"
services:
db:
image: 10.30.36.120/docker/mysql:5.6
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=123
- MYSQL_DATABASE=zabbix
- MYSQL_USER=tom
- MYSQL_PASSWORD=123
zabbix-server:
depends_on:
- db
image: 10.30.36.120/docker/zabbix-server
ports:
- 10051:10051
environment:
- DB_SERVER_HOST=db
- DB_SERVER_PORT=3306
- MYSQL_DATABASE=zabbix
- MYSQL_USER=tom
- MYSQL_PASSWORD=123
zabbix-web:
depends_on:
- db
- zabbix-server
image: 10.30.36.120/docker/zabbix-web-nginx
ports:
- 80:80
environment:
- DB_SERVER_HOST=db
- DB_SERVER_PORT=3306
- MYSQL_DATABASE=zabbix
- MYSQL_USER=tom
- MYSQL_PASSWORD=123
- TZ=Asia/Shanghai
2、启动docker-compose文件
docker-compose -f zabbix.yml up -d
查看docker容器,日志
docker ps
docker-compose -f zabbix.yml logs -f
测试访问,如出现mysql版本不符合问题
6、先进入mysql容器
docker exec -it 431d313a9f7d /bin/bash
mysql -utom -p123
mysql> show databases;
mysql> use zabbix;
mysql> update dbversion set mandatory=4000000;
7、问题解决之后效果