version: "3"
services:
mysql-server:
image: mysql:8.0
container_name: mysql-server
command: --character-set-server=utf8
#--character-set-server=utf8 设置中文解决乱码
restart: always
environment:
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=zabbix_pwd
- MYSQL_ROOT_PASSWORD=root_pwd
ports:
- 3306:3306
volumes:
- /zabbix-mysql:/var/lib/mysql
- /etc/localtime:/etc/localtime
- /etc/timezone:/etc/timezone
zabbix-java-gateway:
image: zabbixmultiarch/zabbix-java-gateway-alpine
container_name: zabbix-java-gateway
zabbix-server-mysql:
image: zabbix/zabbix-server-mysql:alpine-latest
container_name: zabbix-server-mysql
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
#指定容器的 ulimits 限制值最大进程数为 65535,指定文件句柄数为 20000(软限制,应用可以随时修改,不能超过硬限制) 和 40000(系统硬限制,只能 root 用户提高)。
privileged: true
#允许容器中运行一些特权命令
cap_add:
- ALL
#容器的内核能力(capacity)分配
restart: always
environment:
- DB_SERVER_HOST=mysql-server
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=zabbix_pwd
- MYSQL_DATABASE=zabbix
- MYSQL_ROOT_PASSWORD=root_pwd
- ZBX_JAVAGATEWAY=zabbix-java-gateway
ports:
- 10051:10051
links:
- mysql-server:mysql:8.0
depends_on:
- mysql-server
volumes:
- /etc/localtime:/etc/localtime
- /etc/timezone:/etc/timezone
- zabbix-server-conf:/etc/zabbix
- zabbix-server-alertscripts:/usr/lib/zabbix/alertscripts
zabbix-web:
image: zabbix/zabbix-web-nginx-mysql:alpine-latest
environment:
- DB_SERVER_HOST=mysql-server
- PHP_TZ=Asia/Shanghai
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=zabbix_pwd
- MYSQL_DATABASE=zabbix
- MYSQL_ROOT_PASSWORD=root_pwd
- ZBX_SERVER_HOST=zabbix-server-mysql
restart: always
ports:
- 8080:8080
volumes:
- /etc/localtime:/etc/localtime
- /etc/timezone:/etc/timezone
links:
- mysql-server:mysql:8.0
- zabbix-server-mysql:zabbix-server
depends_on:
- mysql-server
- zabbix-server-mysql
zabbix-agent:
image: zabbix/zabbix-agent2
privileged: true
restart: always
cap_add:
- ALL
volumes:
- /etc/timezone:/etc/timezone
environment:
- ZBX_SERVER_HOST=zabbix-server-mysql
ports:
- '10050:10050'
volumes:
zabbix-server-conf:
zabbix-server-alertscripts:
zabbix:docker-compose
最新推荐文章于 2024-09-30 15:57:52 发布