1. 程式人生 > >docker部署zabbix--------------檔案用的compose配置

docker部署zabbix--------------檔案用的compose配置

version: "3" services:   zabbix-mysql:     image: mysql:5.7     container_name: zabbix-mysql     ports:        - '3308'     environment:       - MYSQL_ROOT_PASSWORD="123456"     volumes:       - ./mysql_data:/var/lib/mysql   zabbix-web-apache-mysql:     image: zabbix/zabbix-web-apache-mysql     container_name: zabbix-web-apache-mysql     environment:       - DB_SERVER_HOST=zabbix-mysql       - MYSQL_USER=root       - MYSQL_PASSWORD="123456"       - ZBX_SERVER_HOST=zabbix-server-mysql       - PHP_TZ=Asia/Shanghai     ports:       - '8083:80'       - '8443:443'     links:       - zabbix-mysql       - zabbix-server-mysql     depends_on:       - zabbix-mysql   zabbix-server-mysql:     image: zabbix/zabbix-server-mysql     container_name: zabbix-server-mysql     environment:       - DB_SERVER_HOST=zabbix-mysql       - MYSQL_USER=root       - MYSQL_PASSWORD="123456"     ports:       - '10051:10051'     links:       - zabbix-mysql     depends_on:       - zabbix-mysql  

------------------------------------------------------------------------------------------------------------------------------------------------

啟動映象3個

docker run --name zabbix-mysql-server --hostname zabbix-mysql-server \ -e MYSQL_ROOT_PASSWORD="123456" \ -e MYSQL_USER="zabbix" \ -e MYSQL_PASSWORD="123456" \ -e MYSQL_DATABASE="zabbix" \ -p 3308:3308  \ -d mysql:5.6.36 \ --character-set-server=utf8 --collation-server=utf8_bin ------------------------------------------------------------------------------------- 新增埠firewall-cmd --permanent --zone=public --add-port=3690/tcp 清除映象docker rm -f $(docker ps -a -q) docker save -o gitlab_ce.tar registry.cn-hangzhou.aliyuncs.com/imooc/gitlab-ce ------------------------------------------------------------------------------------------------ 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 \ -p 10051:10051 \ -d \ zabbix/zabbix-server-mysql -------------------------------------------------------------------------------------------------- docker 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" \ -p 8000:80 \ -p 8443:443 \ -d \

zabbix/zabbix-web-nginx-mysql