The container provides the following Zabbix Services, please refer to the Zabbix documentation for additional info.
- A Zabbix Server at port 10051.
- A Zabbix Java Gateway at port 10052.
- A Zabbix Web UI at port 80 (e.g.
- A Zabbix Agent.
- A MySQL instance supporting Zabbix, user is
zabbixand password is
- A Monit deamon managing the processes (http://$container_ip:2812, user 'myuser' and password 'mypassword').
You can run Zabbix as a service executing the following command.
docker run -d \ -p 10051:10051 \ -p 10052:10052 \ -p 80:80 \ -p 2812:2812 \ berngp/docker-zabbix
The above command will expose the Zabbix Server through port 10051 and the Web UI through port 80 on the host instance, among others.
Be patient, it takes a minute or two to configure the MySQL instance and start the proper services. You can tail the logs using
docker logs -f $contaienr_id.
After the container is ready the Zabbix Web UI should be available at
http://$container_ip/zabbix. User is
admin and password is
Setting your Docker environment with the Vagrantfile
To run the included Vagrantfile you will need VirtualBox and Vagrant installed. Currently I am testing it against VirtualBox 4.3.6 and Vagrant 1.4.1. The Vagrantfile uses a minimal Ubuntu Precise 64 box and installs the VirtualBox Guest Additions along with Docker and its dependencies. The first time you execute a
vagrant up it will go through an installation and build process, after its done you will have to execute a
vagrant reload. After that you should be able to do a
vagrant ssh and find that Docker is available using a
which docker command.
Be aware that the Vagrantfile depends on the version of VirtualBox and may run into problems if you don't have the latest versions.
Once your Vagrant instance is up you should be able to ssh in (
vagrant ssh) and have the
docker command available. By default Docker is also started as a service/daemon.
Building the Docker Zabbix Repository.
Within an environment that is already running Docker, such as the VirtualBox instance described above, checkout the docker-zabbix code to a known directory. If you are using the Vagrantfile it will be available by default in the
/docker/docker-zabbix directory. From there you can execute a build and run the container.
# CD into the docker container code. cd /docker/docker-zabbix # Build the contaienr code. docker build -t berngp/docker-zabbix . # Run it! docker run -i -t \ -p 10051:10051 \ -p 10052:10052 \ -p 80:80 \ -p 2812:2812 \ berngp/docker-zabbix
Exploring the Docker Zabbix Container
Sometimes you might just want to review how things are deployed inside the container. You can do that by bootstrapping the container and jumping into a bash shell.
Execute the command bellow to do it.
docker run -i -t -p 10051 \ -p 10052 \ -p 80 \ -p 2812 \ --entrypoint="" berngp/docker-zabbix /bin/bash
Note that in the example above we are telling docker to bind ports 10051, 10052, 80 and 2812 but we are not giving explicit mapping of those ports. You will have to run
docker ps to figure out the port mappings in relationship with the host.
Happy metrics gathering!
how can i connect to mysql since container ?
because when i run the container i get
Error connecting to database: Access denied for user 'zabbix'@'localhost' (using password: YES)