Public | Automated Build

Last pushed: 2 years ago
Short Description
Fork zabbix
Full Description

Zabbix Community Dockerfiles

Zabbix Github repo is
intended as a source for Zabbix Docker registry.
Please use these community Zabbix Docker images, if you want to
build/ship your own Zabbix Docker image.


Zabbix 2.4 is not supported - please use 3.0 version -

Compiled zabbix with almost all features (MySQL support, Java, SNMP,
Curl, IPMI, IPv6, Jabber, fping) and Zabbix web UI based on CentOS 7,
Supervisor, Nginx, PHP. Image requires external MySQL/MariaDB database (you can
run MySQL/MariaDB also as Docker container).

Standard Dockerized Zabbix deployement

# create /var/lib/mysql as persistent volume storage
docker run -d -v /var/lib/mysql --name zabbix-db-storage busybox:latest

# start DB for zabbix - default 1GB innodb_buffer_pool_size is used
docker run \
    -d \
    --name zabbix-db \
    -v /backups:/backups \
    -v /etc/localtime:/etc/localtime:ro \
    --volumes-from zabbix-db-storage \
    --env="MARIADB_USER=zabbix" \
    --env="MARIADB_PASS=my_password" \

# start Zabbix linked to started DB
docker run \
    -d \
    --name zabbix \
    -p 80:80 \
    -p 10051:10051 \
    -v /etc/localtime:/etc/localtime:ro \
    --link zabbix-db:zabbix.db \
    --env="ZS_DBHost=zabbix.db" \
    --env="ZS_DBUser=zabbix" \
    --env="ZS_DBPassword=my_password" \
# wait ~60 seconds for Zabbix initialization
# Zabbix web UI will be available on the port 80, Zabbix server on the port 10051

# Backup of Zabbix configuration data only
docker exec \
    -ti zabbix-db \
    /zabbix-backup/zabbix-mariadb-dump -u zabbix -p my_password -o /backups

# Full DB backup of Zabbix
docker exec \
    -ti zabbix-db \
    bash -c "\
    mysqldump -u zabbix -pmy_password zabbix | \
    bzip2 -cq9 > /backups/zabbix_db_dump_$(date +%Y-%m-%d-%H.%M.%S).sql.bz2"

Up and Running with Docker Compose

docker-compose up -d

Zabbix database as Docker container

To be able to connect to database we would need one to be running first.
Easiest way to do that is to use another docker image. For this purpose you
can use [zabbix/zabbix-db-mariadb]
( image as database.

For more information about zabbix/zabbix-db-mariadb see
[README of zabbix-db-mariadb]


docker run \
    -d \
    --name zabbix-db \
    -p 3306:3306 \
    -v /etc/localtime:/etc/localtime:ro \
    --env="MARIADB_USER=zabbix" \
    --env="MARIADB_PASS=my_password" \

Remember to use the same credentials when deploying zabbix image.

Environmental variables

You can use environmental variables to config Zabbix server and Zabbix web UI (PHP). Available

Variable Default value
PHP_date_timezone UTC
PHP_max_execution_time 300
PHP_max_input_time 300
PHP_memory_limit 128M
PHP_error_reporting E_ALL
ZS_ListenPort 10051
ZS_LogFile /tmp/zabbix_server.log
ZS_LogFileSize 10
ZS_DebugLevel 3
ZS_PidFile /var/run/
ZS_DBHost zabbix.db
ZS_DBName zabbix
ZS_DBUser zabbix
ZS_DBPassword zabbix
ZS_DBSocket /tmp/mysql.sock
ZS_DBPort 3306
ZS_StartPollers 5
ZS_StartPollersUnreachable 1
ZS_StartTrappers 5
ZS_StartPingers 1
ZS_StartDiscoverers 1
ZS_StartHTTPPollers 1
ZS_StartTimers 1
ZS_JavaGatewayPort 10052
ZS_StartJavaPollers 0
ZS_StartVMwareCollectors 0
ZS_VMwareFrequency 60
ZS_VMwarePerfFrequency 60
ZS_VMwareCacheSize 8M
ZS_VMwareTimeout 10
ZS_SNMPTrapperFile /tmp/zabbix_traps.tmp
ZS_StartSNMPTrapper 0
ZS_HousekeepingFrequency 1
ZS_MaxHousekeeperDelete 500
ZS_SenderFrequency 30
ZS_CacheSize 8M
ZS_CacheUpdateFrequency 60
ZS_StartDBSyncers 4
ZS_HistoryCacheSize 8M
ZS_TrendCacheSize 4M
ZS_HistoryTextCacheSize 16M
ZS_ValueCacheSize 8M
ZS_Timeout 3
ZS_TrapperTimeout 300
ZS_UnreachablePeriod 45
ZS_UnavailableDelay 60
ZS_UnreachableDelay 15
ZS_AlertScriptsPath /usr/local/share/zabbix/alertscripts
ZS_ExternalScripts /usr/local/share/zabbix/externalscripts
ZS_FpingLocation /usr/sbin/fping
ZS_Fping6Location /usr/sbin/fping6
ZS_LogSlowQueries 0
ZS_TmpDir /tmp
ZS_StartProxyPollers 1
ZS_ProxyConfigFrequency 3600
ZS_ProxyDataFrequency 1
ZS_AllowRoot 0
ZS_User zabbix
ZS_SSLCertLocation /usr/local/share/zabbix/ssl/certs
ZS_SSLKeyLocation /usr/local/share/zabbix/ssl/keys
ZS_LoadModulePath /usr/lib/zabbix/modules
ZW_ZBX_SERVER localhost

Configuration from volume

Full config files can be also used. Environment configs will be overriden by
values from config files in this case. You need only to add /etc/custom-config/

-v /host/custom-config/:/etc/custom-config/

Available files:

File Description
php-zabbix.ini PHP configuration file
zabbix_server.conf Zabbix server configuration file

Zabbix role environment variables:

Variable Default value Description
ZS_enabled true Zabbix Server enablement, DB operations will be enabled as well
ZA_enabled true Zabbix Agent enablement, DB operations will be enabled as well
ZW_enabled true Zabbix Web UI enablement, DB operations will be enabled as well
SNMPTRAP_enabled false SNMP trap process (port 162) enablement

All Zabbix components are enabled by default except SNMP traps proccessing. However users
want to run dedicated Zabbix component per container. Typical use case is Zabbix
web UI. Thanks to role environemnt variables are users able to execute many web
UI containers, which helps to scale Zabbix as a service.

Zabbix deployment

Now when we have Zabbix database running we can deploy zabbix image with
appropriate environmental variables set.


docker run \
    -d \
    --name zabbix \
    -p 80:80 \
    -p 10051:10051 \
    -v /etc/localtime:/etc/localtime:ro \
    --link zabbix-db:zabbix.db \
    --env="ZS_DBHost=zabbix.db" \
    --env="ZS_DBUser=zabbix" \
    --env="ZS_DBPassword=my_password" \

Access to Zabbix web interface

To log in into zabbix web interface for the first time use credentials

Access web interface under http://docker_host_ip

Docker troubleshooting

Use docker command to see if all required containers are up and running:

$ docker ps

Check logs of Zabbix container:

$ docker logs zabbix

Sometimes you might just want to review how things are deployed inside a running
container, you can do this by executing a bash shell through docker's

docker exec -ti zabbix /bin/bash

History of an image and size of layers:

docker history --no-trunc=true zabbix/zabbix-2.4 | tr -s ' ' | tail -n+2 | awk -F " ago " '{print $2}'

Run specific Zabbix version, e.g. 2.4.4 - just specify 2.4.4 tag for image:

    docker run \
        -d \
        --name zabbix \
        -p 80:80 \
        -p 10051:10051 \
        -v /etc/localtime:/etc/localtime:ro \
        --link zabbix-db:zabbix.db \
        --env="ZS_DBHost=zabbix.db" \
        --env="ZS_DBUser=zabbix" \
        --env="ZS_DBPassword=my_password" \
Docker Pull Command