vi /etc/docker/daemon.json docker --registry-mirror=https://docker.mirrors.ustc.edu.cn -d { "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] } docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data docker.mirrors.ustc.edu.cn/portainer/portainer http://39.101.220.120/zabbix docker pull buddyfly/openwrt-aarch64 docker run --name zabbix-agent --link some-zabbix-appliance:zabbix-server -d zabbix/zabbix-agent docker run --name front1 -p 80:80 443:443 --link zabbix:zabbix-server -e DB_SERVER_HOST="rm-8vbsq38a757j79x3l58870.mysql.zhangbei.rds.aliyuncs.com" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="Lincs-zjk" -e ZBX_SERVER_HOST="zabbix-server" -e PHP_TZ="Asia/Shanghai" -d zabbix/zabbix-web-nginx-mysql docker inspect -f "{{ .HostConfig.Links }}" some-zabbix-appliance Agent docker run --name z-agent -e ZBX_HOSTNAME="zabbix-host" -e ZBX_SERVER_HOST="z-server" -p 10050:10050 -d zabbix/zabbix-agent Where z-agent is the name you want to assign to your container, zabbix-host is the hostname, it is Hostname parameter in Zabbix agent configuration file, z-server is IP or DNS name of Zabbix server or proxy Connects from Zabbix server or Zabbix proxy in other containers (Passive checks) This image exposes the standard Zabbix agent port (10050) to perform passive checks, so container linking makes Zabbix agent instance available to Zabbix server and Zabbix proxy containers. Start your application container like this in order to link it to the Zabbix agent container: $ docker run --name z-server --link z-agent:zabbix-agent -d zabbix/zabbix-server Connect to Zabbix server or Zabbix proxy containers (Active checks) This image supports perform active checks, so container linking makes Zabbix server and Zabbix proxy containers available to Zabbix agent instance. Start your application container like this in order to link Zabbix agent to Zabbix server or Zabbix proxy containterns: docker run --name z-agent --link z-server-mysql:zabbix-server -d zabbix/zabbix-agent Container shell access and viewing Zabbix agent logs The docker exec command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your zabbix-agent container: $ docker exec -ti z-agent /bin/bash The Zabbix agent log is available through Docker's container log: $ docker logs z-agent Privileged mode By default, Docker containers are "unprivileged" and do not have access to the most of host resources. Zabbix agent is designed to monitor system resources, to do that Zabbix agent container must be privileged or you may mount some system-wide volumes. For example: $ docker run --name z-agent --link z-server:zabbix-server --privileged -d zabbix/zabbix-agent $ docker run --name z-agent --link z-server:zabbix-server -v /dev/sdc:/dev/sdc -d zabbix/zabbix-agent Environment Variables FrontEnd Start zabbix-web-nginx-mysql Start a Zabbix web-interface container as follows: docker run --name some-zabbix-web-nginx-mysql -e DB_SERVER_HOST="rm-8vbsq38a757j79x3l58870.mysql.zhangbei.rds.aliyuncs.com" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="Lincs-zjk" -e ZBX_SERVER_HOST="z-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-mysql Where some-zabbix-web-nginx-mysql is the name you want to assign to your container, some-mysql-server is IP or DNS name of MySQL server, some-user is user to connect to Zabbix database on MySQL server, some-password is the password to connect to MySQL server, z-server is IP or DNS name of Zabbix server or proxy, some-timezone is PHP like timezone name and tag is the tag specifying the version you want. See the list above for relevant tags, or look at the full list of tags. Linking the container to Zabbix server docker run --name some-zabbix-web-nginx-mysql --link z-server:zabbix-server -e DB_SERVER_HOST="rm-8vbsq38a757j79x3l58870.mysql.zhangbei.rds.aliyuncs.com" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="Lincs-zjk" -e ZBX_SERVER_HOST="z-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-mysql Linking the container to MySQL database docker run --name some-zabbix-web-nginx-mysql --link some-mysql-server:mysql -e DB_SERVER_HOST="rm-8vbsq38a757j79x3l58870.mysql.zhangbei.rds.aliyuncs.com" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="Lincs-zjk" -e ZBX_SERVER_HOST="z-server" -e PHP_TZ="some-timezone" -d zabbix/zabbix-web-nginx-mysql Container shell access and viewing Zabbix web interface logs The docker exec command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your zabbix-web-nginx-mysql container: $ docker exec -ti some-zabbix-web-nginx-mysql /bin/bash The Zabbix web interface log is available through Docker's container log: $ docker logs some-zabbix-web-nginx-mysql Start zabbix-server-mysql Start a Zabbix server container as follows: docker run --name z-server-mysql -e DB_SERVER_HOST="rm-8vbsq38a757j79x3l58870.mysql.zhangbei.rds.aliyuncs.com" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="Lincs-zjk" -d zabbix/zabbix-server-mysql Where z-server-mysql is the name you want to assign to your container, some-mysql-server is IP or DNS name of MySQL server, some-user is user to connect to Zabbix database on MySQL server, some-password is the password to connect to MySQL server and tag is the tag specifying the version you want. See the list above for relevant tags, or look at the full list of tags. Container shell access and viewing Zabbix server logs The docker exec command allows you to run commands inside a Docker container. The following command line will give you a bash shell inside your zabbix-server-mysql container: $ docker exec -ti z-server-mysql /bin/bash The Zabbix server log is available through Docker's container log: $ docker logs z-server-mysql Environment Variables When you start the zabbix-server-mysql image, you can adjust the configuration of the Zabbix server by passing one or more environment variables on the docker run command line. DB_SERVER_HOST This variable is IP or DNS name of MySQL server. By default, value is 'mysql-server' DB_SERVER_PORT This variable is port of MySQL server. By default, value is '3306'. MYSQL_USER, MYSQL_PASSWORD, MYSQL_USER_FILE, MYSQL_PASSWORD_FILE These variables are used by Zabbix server to connect to Zabbix database. With the _FILE variables you can instead provide the path to a file which contains the user / the password instead. Without Docker Swarm or Kubernetes you also have to map the files. Those are exclusive so you can just provide one type - either MYSQL_USER or MYSQL_USER_FILE! docker run --name z-server-mysql -e DB_SERVER_HOST="rm-8vbsq38a757j79x3l58870.mysql.zhangbei.rds.aliyuncs.com" -v ./.MYSQL_USER:/run/secrets/MYSQL_USER -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -v ./.MYSQL_PASSWORD:/run/secrets/MYSQL_PASSWORD -e MYSQL_PASSWORD_FILE=/var/run/secrets/MYSQL_PASSWORD -d zabbix/zabbix-server-mysql With Docker Swarm or Kubernetes this works with secrets. That way it is replicated in your cluster! printf "zabbix" | docker secret create MYSQL_USER - printf "zabbix" | docker secret create MYSQL_PASSWORD - docker run --name z-server-mysql -p 10051:10051 -e DB_SERVER_HOST="rm-8vbsq38a757j79x3l58870.mysql.zhangbei.rds.aliyuncs.com" -e MYSQL_USER_FILE=/run/secrets/MYSQL_USER -e MYSQL_PASSWORD_FILE=/run/secrets/MYSQL_PASSWORD -d zabbix/zabbix-server-mysql This method is also applicable for MYSQL_ROOT_PASSWORD with MYSQL_ROOT_PASSWORD_FILE. By default, values for MYSQL_USER and MYSQL_PASSWORD are zabbix, zabbix. MYSQL_DATABASE The variable is Zabbix database name. By default, value is zabbix. ZBX_LOADMODULE The variable is list of comma separated loadable Zabbix modules. It works with volume /var/lib/zabbix/modules. The syntax of the variable is dummy1.so,dummy2.so. ZBX_DEBUGLEVEL The variable is used to specify debug level. By default, value is 3. It is DebugLevel parameter in zabbix_server.conf. Allowed values are listed below: 0 - basic information about starting and stopping of Zabbix processes; 1 - critical information 2 - error information 3 - warnings 4 - for debugging (produces lots of information) 5 - extended debugging (produces even more information) ZBX_TIMEOUT The variable is used to specify timeout for processing checks. By default, value is 4. ZBX_JAVAGATEWAY_ENABLE The variable enable communication with Zabbix Java Gateway to collect Java related checks. By default, value is false.