The combination of using Docker to build Zabbix is Mysql+docker+zabix-server, using the Zabbix container to connect to the MySQL container, the database file of the MySQL container is guaranteed to exist the physical host/opt/mysql_db/mysql/ The DataDir directory. Test environment
1, the operating system version is: Centos7. 5 2, the Docker version is:1.13. 1 3 . mysql database is:5.7
1 Installing Docker
Yum install docker- y
Systemctl Start Docker
Systemctl Enable Docker
2 Modifying the default Docker image address
sudo mkdir-p/etc//etc/docker/daemon.json <<-'EOF'{ " registry-mirrors": ["https://3pm9ld7m.mirror.aliyuncs.com" ]}eofsudo systemctl daemon-reloadsudo systemctl restart Docker
3 Install the database first MySQL
Docker run--name zabbix-mysql-server--hostname zabbix-mysql-Server-v/opt/mysql_db/mysql/conf/etc/mysql/conf.d-v/opt/mysql_db/mysql/datadir:/var/lib/mysql--privileged=true -E mysql_root_password="123456" -E mysql_user="Zabbix" -E mysql_password="123456" -E mysql_database="Zabbix" -P3306:3306 -D MySQL:5.7 --character-Set-server=utf8--collation-server=utf8_bin
4 Creating Zabbix-server
Docker run--name zabbix-server-mysql--hostname zabbix-server-MySQL--link zabbix-mysql-Server:mysql-E db_server_host="MySQL" -E mysql_user="Zabbix" -E mysql_database="Zabbix" -E mysql_password="123456" -v/etc/localtime:/etc/Localtime:ro-v/data/docker/zabbix/alertscripts:/usr/lib/zabbix/alertscripts-v/data/docker/zabbix/externalscripts:/usr/lib/zabbix/externalscripts-P10051:10051 -D Zabbix/zabbix-server-mysql
5 Last Web-nginx
Final installation zabbix-web-Nginxdocker Run--name Zabbix-web-nginx-mysql--hostname zabbix-web-nginx-MySQL--link zabbix-mysql-Server:mysql--link zabbix-server-mysql:zabbix-Server-E db_server_host="MySQL" -E mysql_user="Zabbix" -E mysql_password="123456" -E mysql_database="Zabbix" -E zbx_server_host="Zabbix-server" -E php_tz="Asia/shanghai" -P8000: the -P8443:443 -D Zabbix/zabbix-web-nginx-mysql
6 Results Test
Browser access ip:8000 View default login Username:Adminpassword:zabbix
7 docker-zabbbix-agent Installation and link zabbix-server
Docker run--name zabbix-agent--link zabbix-server-mysql:zabbix-server-d zabbix/zabbix-agent:latest
Finally, you need to add the zabbix-agent to the Zabbix-server host list on the web side.
Docker+mysql+zabix-server Environment Construction