zabbix/zabbix-docker

None of the Docker-Compose files work

linad181 opened this issue · 7 comments

SUMMARY

Following Zabbix documentation on building a Zabbix server using docker-compose none of the docker-compose files in the Zabbix Github repo will build the server. They all result in an error concerning the "volumes" entry for several services as containing an invalid type.

OS / ENVIRONMENT / Used docker-compose files

New install of Ubuntu 22.04.3 on XCP-NG host
2 CPUs, 8 GBs RAM, 128 GB hard drive
Tried ALL available docker-compose files

CONFIGURATION

No changes to any .env_* files.
Docker Compose command used:
docker-compose -f docker-compose_v3_ubuntu_mysql_latest.yaml up -d

STEPS TO REPRODUCE

Followed steps in Zabbix Official Documentation: https://www.zabbix.com/documentation/current/en/manual/installation/containers#docker-compose

git clone https://github.com/zabbix/zabbix-docker.git
cd zabbix-docker
git checkout 6.4
docker-compose -f docker-compose_v3_ubuntu_mysql_latest.yaml up -d
EXPECTED RESULTS

Zabbix services should download and run on VM

ACTUAL RESULTS

Every compose files I tried to build resulted in the error below. When I check both the "docker-compose_v3_ubuntu_mysql_latest.yaml" and "compose_zabbix_components.yaml" indicated file I do notice that there are a lot of "volume" keys that appear to be commented out.

For example, in the "compose_zabbix_components.yaml" file under the first errored service of "zabbix-proxy-mysql." the following config is present for the "volumes" key:

volumes:
#   - dbsocket:/var/run/mysqld/

The other services listed in the error below have the same "volumes" config.

Error Output:

ERROR: The Compose file '/home/fpecka/zabbix-docker/compose_zabbix_components.yaml' is invalid because:
services.zabbix-proxy-mysql.volumes contains an invalid type, it should be an array
services.zabbix-server-mysql.volumes contains an invalid type, it should be an array
services.zabbix-server-pgsql.volumes contains an invalid type, it should be an array
services.zabbix-web-apache-mysql.volumes contains an invalid type, it should be an array
services.zabbix-web-apache-pgsql.volumes contains an invalid type, it should be an array
services.zabbix-web-nginx-mysql.volumes contains an invalid type, it should be an array
services.zabbix-web-nginx-pgsql.volumes contains an invalid type, it should be an array

Change the .env file the location something that you have access to for the storage. Don't use dot in the front untill you figure out that this means. Sure you will need to describe where is env cars directory, that's one line below.

Screenshot_2024-01-03-17-54-11-96_50ecd26a21c2c56ce608de5e94733463

I'm thinking you need follow official recommendations for XCP-NG. Docker compose on Vanilla Ubuntu with official docker works fine.

Change the .env file the location something that you have access to for the storage.

Hi cieska! I modified the 2 variable paths to the explicit path to the zabbix-docker git folder:

DATA_DIRECTORY=/home/fpecka/zabbix-docker/zbx_env
ENV_VARS_DIRECTORY=/home/fpecka/zabbix-docker/env_vars

The folder and files are located in my home folder and I've confirmed that all permissions on the folder and sub-files are all set to my account. No changes when running the docker-compose command.


I'm thinking you need follow official recommendations for XCP-NG.

Hi dotneft, Can you link to any recommendations related to XCP-NG? I'm not really sure what bearing being a VM would have on the issue. I've run docker-compose successfully on other XCP-NG hosted VMs. The current VM's disk is thick-provisioned so it has all the available disk-space accessible without waiting for I/O expansion.

One thing I noticed as well, the docker-compose files I'm attempting to run ("docker-compose_v3_ubuntu_mysql_latest.yaml") seems does not actually call to some of the services that are shown in the error I originally posted.

For instance, the following services:

zabbix-server-pgsql
zabbix-web-apache-pgsql
zabbix-web-nginx-pgsql

are not part the docker-compose files "docker-compose_v3_ubuntu_mysql_latest.yaml", which makes sense as these are related to the PosgreSQL version and I'm attempting to run the MySQL version.

However, are those PosgreSQL services supposed to be called from the "docker-compose_v3_ubuntu_mysql_latest.yaml" fille? I am not an expert in docker-compose by any means, but it seems strange that it's calling to services that are not even listed in the original file.

Have you cloned all repo or just yaml file you need? As there is other related things required.
Not sure why it doesn't work as it worked for me just a few days ago. I have only changed some of database vars and path I have mentioned.

Yes, I cloned the entire respository using the command in the Zabbix documentation:
git clone https://github.com/zabbix/zabbix-docker.git

After some further troubleshooting and interpreting of documentation I have come to realize that I did miss one item. Evidently the installation of the database server is not covered underneath the initial install of services. It must be installed separately before running the Zabbix docker-compose file.

However, that alone did still did not resolve the issue. Once the MySQL server was installed and started I still had to modify the "compose_zabbix_components.yaml" and "docker-compose_v3_ubuntu_mysql_latest.yaml" files to uncomment the volumes list under each service that was reported in my original error.

For example, in the "compose_zabbix_components.yaml" file under the "zabbix-proxy-mysql" service I needed to change the following lines from:

 volumes:
#   - dbsocket:/var/run/mysqld/

To:

volumes:
  - dbsocket:/var/run/mysqld/

This needed to be done for the remaining services that errored:

  • zabbix-server-mysql
  • zabbix-server-pgsql
  • zabbix-web-apache-mysql
  • zabbix-web-apache-pgsql
  • zabbix-web-nginx-mysql
  • zabbix-web-nginx-pgsql

Then, in the "docker-compose_v3_ubuntu_mysql_latest.yaml" file (or whichever file is used) I had to uncomment the volumes key as well. Changing it from:

volumes:
  snmptraps:
#  dbsocket:

To:

volumes:
  snmptraps:
  dbsocket:

Once these volume entries were uncommented docker-compose was able to successfully build the server and I now have access.