启动zabbix容器
启动一个mysql的容器
docker run --name mysql-server -t \-e MYSQL_DATABASE="zabbix" \-e MYSQL_USER="zabbix" \-e MYSQL_PASSWORD="zabbix_pwd" \-e MYSQL_ROOT_PASSWORD="root_pwd" \-d mysql:5.7 \--character-set-server=utf8 --collation-server=utf8_bin
启动java-gateway容器监控java服务
docker run --name zabbix-java-gateway -t \-d zabbix/zabbix-java-gateway:latest
启动zabbix-mysql容器使用link连接mysql与java-gateway
docker run --name zabbix-server-mysql -t \-e DB_SERVER_HOST="mysql-server" \-e MYSQL_DATABASE="zabbix" \-e MYSQL_USER="zabbix" \-e MYSQL_PASSWORD="zabbix_pwd" \-e MYSQL_ROOT_PASSWORD="root_pwd" \-e ZBX_JAVAGATEWAY="zabbix-java-gateway" \--link mysql-server:mysql \--link zabbix-java-gateway:zabbix-java-gateway \-p 10051:10051 \-d zabbix/zabbix-server-mysql:latestdocker run --name zabbix-server-mysql -t \-e DB_SERVER_HOST="mysql-server" \-e MYSQL_DATABASE="zabbix" \-e MYSQL_USER="zabbix" \-e MYSQL_PASSWORD="zabbix_pwd" \-e MYSQL_ROOT_PASSWORD="root_pwd" \-e ZBX_JAVAGATEWAY="zabbix-java-gateway" \--link mysql-server:mysql \--link zabbix-java-gateway:zabbix-java-gateway \-p 10051:10051 \-d zabbix/zabbix-server-mysql:5.4.3-alpine
10.2.4 启动zabbix web显示,使用link连接zabbix-mysql与mysql
docker run --name zabbix-web-nginx-mysql -t \-e DB_SERVER_HOST="mysql-server" \-e MYSQL_DATABASE="zabbix" \-e MYSQL_USER="zabbix" \-e MYSQL_PASSWORD="zabbix_pwd" \-e MYSQL_ROOT_PASSWORD="root_pwd" \--link mysql-server:mysql \--link zabbix-server-mysql:zabbix-server \-p 80:80 \-d zabbix/zabbix-web-nginx-mysql:latestdocker run --name zabbix-web-nginx-mysql -t \-e DB_SERVER_HOST="mysql-server" \-e MYSQL_DATABASE="zabbix" \-e MYSQL_USER="zabbix" \-e MYSQL_PASSWORD="zabbix_pwd" \-e MYSQL_ROOT_PASSWORD="root_pwd" \--link mysql-server:mysql \--link zabbix-server-mysql:zabbix-server \-p 80:80 \-p 8080:8080 \-d zabbix/zabbix-web-nginx-mysql:5.4.3-ubuntu