创建docker网络
docker network create --subnet 172.30.0.0/16 --ip-range 172.30.122.0/20 zabbix-network
部署mysql-v8.0
docker run --name mysql -t \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="123456" \ -e MYSQL_ROOT_PASSWORD='123456' \ -v /etc/localtime:/etc/localtime \ -v /data/docker_pv/mysql/data:/var/lib/mysql \ -p 3306:3306 \ --network=zabbix-network \ -d mysql:8 \ --character-set-server=utf8 --collation-server=utf8_bin \ --default-authentication-plugin=mysql_native_password
部署zabbix-server
//生产环境密码不要123456 docker run --name zabbix-server-mysql -t \ -e DB_SERVER_HOST="mysql" \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="123456" \ -e MYSQL_ROOT_PASSWORD="123456" \ --link mysql:mysql \ --network=zabbix-network \ -p 10051:10051 \ -v /etc/localtime:/etc/localtime \ -v /data/docker_pv/zabbix/zabbix-server/alertscripts:/usr/lib/zabbix/alertscripts \ --restart unless-stopped \ -d zabbix/zabbix-server-mysql:6.0-centos-latest
部署zabbix-web
docker run --name zabbix-web-nginx-mysql -t \ -e DB_SERVER_HOST="mysql" \ -e MYSQL_DATABASE="zabbix" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="123456" \ -e MYSQL_ROOT_PASSWORD="123456" \ -e ZBX_SERVER_HOST="192.168.122.195" \ -e ZBX_SERVER_PORT="10051" \ --link mysql:mysql \ --link zabbix-server-mysql:zabbix-server-mysql \ --network=zabbix-network \ -v /etc/localtime:/etc/localtime \ -p 80:8080 \ -d zabbix/zabbix-web-nginx-mysql:6.0-centos-latest
浏览器访问:http://IP