参考博客:https://www.cnblogs.com/root0/p/9812789.html

在实际部署中稍做改动,做记录

1 官方地址

官方写的很详细并且是中文的,一步步按照操作就可以

https://www.zabbix.com/documentation/3.4/zh/manual/installation/containers

2 启动一个空的Mysql服务器实例

docker run --name mysql-server -t \
 -e MYSQL_DATABASE="zabbix" \
 -e MYSQL_USER="zabbix" \
 -e MYSQL_PASSWORD="zabbix_111" \
 -e MYSQL_ROOT_PASSWORD="root_111" \
 -v /data/mysql:/var/lib/mysql \
 -p 3306:3306 \
 -d mysql

3 启动Zabbix server实例,并关联这个实例到已创建的MySQL服务器实例

docker run --name  zabbix-server-mysql  -t \
       -e DB_SERVER_HOST="192.168.0.30" \
       -e MYSQL_DATABASE="zabbix" \
       -e MYSQL_USER="zabbix" \
       -e MYSQL_PASSWORD="zabbix_111" \
       -e MYSQL_ROOT_PASSWORD="root_111" \
       --link mysql-server:mysql \
       -p 10051:10051 \
       -d zabbix/zabbix-server-mysql:latest      

4 启动Zabbix web 接口,并将它与MySQL服务器实例和Zabbix server实例关联

加了一个配置文档的挂载, -v /etc/php/99-zabbix.ini:/etc/php7/conf.d/99-zabbix.ini 用来修改时区设置,

vim /etc/php/99-zabbix.ini
 max_execution_time=600
 memory_limit=128M
 post_max_size=16M
 upload_max_filesize=2M
 max_input_time=300
 ; always_populate_raw_post_data=-1
 max_input_vars=10000
 ; date.timezone=Europe/Riga
 date.timezone=Asia/Shanghai
 ; session.save_path=/var/lib/php7
docker run --name zabbix-nginx -t \
       -e DB_SERVER_HOST="192.168.0.30" \
       -e MYSQL_DATABASE="zabbix" \
       -e MYSQL_USER="zabbix" \
       -e MYSQL_PASSWORD="zabbix_111" \
       -e MYSQL_ROOT_PASSWORD="root_111" \
       --link mysql-server:mysql \
       --link zabbix-server-mysql:zabbix-server \
       -v /etc/php/99-zabbix.ini:/etc/php7/conf.d/99-zabbix.ini \
       -p 80:80 \
       -d zabbix/zabbix-web-nginx-mysql:latest

5 查看容器启动情况

[root@zabbix_server ~]# docker ps
CONTAINER ID        IMAGE                                  COMMAND                  CREATED              STATUS              PORTS                           NAMES
98cbe8d8a6bd        zabbix/zabbix-web-nginx-mysql:latest   "docker-entrypoint.sh"   6 seconds ago        Up 5 seconds        443/tcp, 0.0.0.0:8080->80/tcp   zabbix-web-nginx-mysql
de040d43d60f        zabbix/zabbix-server-mysql:latest      "docker-entrypoint.sh"   59 seconds ago       Up 59 seconds       0.0.0.0:10051->10051/tcp        zabbix-server-mysql
3276f18def8d        mysql:5.7                              "docker-entrypoint.s…"   About a minute ago   Up About a minute   3306/tcp                        mysql-server
[root@zabbix_server ~]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
zabbix/zabbix-web-nginx-mysql   latest              4db891b4393a        10 hours ago        177MB
zabbix/zabbix-server-mysql      latest              f5e58dafe9ac        10 hours ago        62.2MB
mysql                           5.7                 f0f3956a9dd8        7 days ago          409MB

6 修改防火墙

iptables -P FORWARD ACCEPT

7 访问web界面

http:/192.168.0.30:80

帐号密码:
Admin
zabbix

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据