← Back to list

Zabbix in Docker: Monitoring Made Portable

Why are we doing this?

Eli Winderickx · 2026-04-18 15:01 · 0 claps · 3.5 min read
#monitoring #zabbix #zabbix-agent #zabbix-server #zabbix-proxy
Open on Medium ↗
Wiki topics: AGT · AI Agents ☁️ · DevOps & Cloud

Zabbix in Docker: Monitoring Made Portable

Why are we doing this?

Zabbix is an incredibly powerful monitoring solution and a highly recommended tool for any IT professional to explore. However, there are certain platforms — such as Microsoft Windows Server — where Zabbix does not run natively.

Don’t worry! There is a reliable alternative: running Zabbix in a container. This method doesn’t just allow you to spin up Zabbix quickly and easily; it opens the door to a wide range of new platforms.

In this guide, we will set up a Docker network, deploy all relevant components with the correct configuration, and create a separate network to host a Zabbix Proxy. This setup simulates a real-world “off-site” proxy scenario.

Note on Ports: The ports chosen for the host device are in a range that works for both Docker and Podman, specifically catering to rootless container setups.

Execution

First, we create a network to connect our core components.

docker network create --subnet 172.20.0.0/16 --ip-range 172.20.240.0/20 zabbix-net

1. The Database

The next crucial step is creating the database. We are using the latest version of MySQL, though PostgreSQL is also an option. We must provide variables like MYSQL_DATABASE, MYSQL_USER, and MYSQL_PASSWORD. We also use -v to map a host directory for persistent data storage. For Zabbix, specifically, we must define the character set and collation.

Podman Users: You must first run podman unshare chown 27:27 /path/to/db to ensure the container has the necessary permissions.

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" \
-v /var/lib/mysql:/var/lib/mysql:Z \
--network=zabbix-net --restart unless-stopped -d mysql \
--character-set-server=utf8 --collation-server=utf8_bin

2. Zabbix Java Gateway (Optional)

This component is only relevant if you plan to monitor Java applications. It requires minimal configuration and simply needs to exist within the network.

Bash

docker run --name zabbix-java-gateway -t \
--network=zabbix-net \
--restart unless-stopped \
-d zabbix/zabbix-java-gateway:alpine-7.0-latest

3. Zabbix SNMP Traps (Optional)

This is necessary only if you plan to receive SNMP traps. We map directories to store received traps and provide MIBs.

docker run --name zabbix-snmptraps -t \
-v /var/lib/zbx_instance/snmptraps:/var/lib/zabbix/snmptraps:rw \
-v /var/lib/zbx_instance/mibs:/usr/share/snmp/mibs:ro \
--network=zabbix-net \
-p 1162:1162/udp \
--restart unless-stopped \
-d zabbix/zabbix-snmptraps:alpine-7.0-latest

4. The Zabbix Server

Now for the core component. Here are the key options we are using:

  • **DB_SERVER_HOST**: References our MySQL container name.
  • **ZBX_ALLOWUNSUPPORTEDDBVERSIONS**: Enables support for MySQL 9. While not officially supported for production yet, it works perfectly for our lab environment.
  • **ZBX_JAVAGATEWAY**: Links the server to the Java Gateway container.
  • **--volumes-from**: Unlike the Java Gateway, the Zabbix server needs direct access to the physical volumes of the SNMP Trapper.
  • Port 11051: We have mapped this to the standard 10051 to demonstrate that Zabbix can operate on custom ports.
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" \
-e ZBX_ENABLE_SNMP_TRAPS="true" \
-e ZBX_ALLOWUNSUPPORTEDDBVERSIONS=1 \
--network=zabbix-net \
-p 11051:10051 \
--volumes-from zabbix-snmptraps \
--restart unless-stopped \
-d zabbix/zabbix-server-mysql:alpine-7.0-latest

5. The Web Interface

To modify configurations and view data, we need the Zabbix web container. It must connect to the same network and database as the server. We use port 8080 for rootless compatibility.

docker run --name zabbix-web-nginx-mysql -t \
-e ZBX_SERVER_HOST="zabbix-server-mysql" \
-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" \
--network=zabbix-net \
-p 8080:8080 \
--restart unless-stopped \
-d zabbix/zabbix-web-nginx-mysql:alpine-7.0-latest

Simulating a Remote Proxy

To make things more challenging and realistic, we will place a Zabbix Proxy in a separate network.

The proxy must be able to reach the Zabbix Server. Since we aren’t specifying a mode, it will start in Active mode by default and attempt to initiate the connection to the server. In a containerized environment, we can use host.docker.internal (for Docker) or host.containers.internal (for Podman) to resolve the host address.

Note: We are using the Zabbix Proxy with SQLite3, which is generally the most efficient database backend for proxies.

docker network create --subnet 172.19.0.0/16 --ip-range 172.19.240.0/20 zabbix-proxy
docker run --name some-zabbix-proxy-sqlite3 --init -d \
-e ZBX_HOSTNAME=remote-proxy \
-e ZBX_SERVER_HOST=host.containers.internal:11051 \
--network=zabbix-proxy \
-p 11055:10051 \
zabbix/zabbix-proxy-sqlite3:latest

The Agent

Finally, we install a Zabbix Agent within the proxy’s network to complete the chain.

docker run --name some-zabbix-agent -e ZBX_HOSTNAME="my-agent" \
-e ZBX_SERVER_HOST=host.containers.internal -e ZBX_SERVER_PORT=11055 \
--network=zabbix-proxy \
--init -d zabbix/zabbix-agent2:latest

Accessing the Web Interface

If all containers are active, the Zabbix web interface should be available at localhost:8080.

  • Default Login: Admin / zabbix.

Configuration Steps:

  • Add the Proxy: Navigate to Administration -> Proxies. Create a new proxy using the exact name used in your environment variables (remote-proxy) and set the mode to Active. Once connected, the status should show "Online" with version 7.0.0.
  • Add the Agent: Go to Data collection -> Hosts. Add a new host with the following details:
  • Host name: my-agent
  • Host groups: Linux servers
  • Proxy: remote-proxy
  • Templates: Linux by Zabbix agent active

Congratulations!

You now have a fully functional Zabbix installation running in Docker! You can now begin monitoring your infrastructure by adding new hosts and linking templates. If you want to dive deeper into the latest features of Zabbix 7.0, check out this official cheat sheet.


메타데이터
post_id
769d0cd9fe90
slug
zabbix-in-docker-monitoring-made-portable-769d0cd9fe90
url
https://medium.com/@eli.winderickx/zabbix-in-docker-monitoring-made-portable-769d0cd9fe90
canonical_url
https://medium.com/@eli.winderickx/zabbix-in-docker-monitoring-made-portable-769d0cd9fe90
author_url
https://medium.com/@eli.winderickx
status
ok
fetched_at
2026-09-15 09:59:32