I am deploying NetXMS via Docker using the official deployment-example/compose.yaml from netxms/docker (commit 55e823c), but replacing the built-in PostgreSQL container with an existing MariaDB instance.
During the database initialization phase, I encountered two related issues:
-
The server/files/dbinit.sh script has "pgsql" strictly hardcoded (nxdbmgr init pgsql), which forces PostgreSQL initialization regardless of the DBDriver configured in /etc/netxmsd.conf or environment variables.
-
If we manually override /dbinit.sh on init container to initialize MariaDB (nxdbmgr init mariadb), the process fails because nxdbmgr looks for a specific dbinit_mariadb.sql file in a directory that does not exist in the Docker image.
Environment:
- NetXMS Version: 6.1.1 (Build 6.1-452-gc20a8a4247)
- Deployment: Docker (using official deployment-example/compose.yaml)
- Database: MariaDB 10.11
Steps to Reproduce:
- Setup the deployment using the example compose.yml file, pointing /etc/netxmsd.conf to a MariaDB database (DBDriver = mariadb.ddr).
- Override /dbinit.sh (entrypoint) on init container via bind mount to execute nxdbmgr init mariadb.
- Start the init container.
Error Log (when using mariadb driver for init):
NetXMS Database Manager Version 6.1.1 Build 6.1-452-gc20a8a4247
Initializing database...
ERROR: Cannot load SQL command file /usr/share/netxms/sql/dbinit_mariadb.sql
Database initialization failed
Unable to determine database syntax
Note: I verified inside the container that the directory /usr/share/netxms does not exist on the NetXMS Server Docker image.
If I change the /etc/netxmsd.conf to use mysql instead (nxdbmgr init mysql), the database initializes perfectly, even though I am using a MariaDB container:
NetXMS Database Manager Version 6.1.1 Build 6.1-452-gc20a8a4247
Initializing database...
IMPORTANT: Generated admin password
Login: admin
Password: PaSsWd
Please save this password - it will not be shown again.
You will be required to change it on first login.
Database initialized successfully
Suggested Fixes:
- Dynamic Driver Selection: Update /dbinit.sh to dynamically read the database driver from a Docker environment variable (e.g., NETXMS_DB_DRIVER) or directly from /etc/netxmsd.conf, falling back to pgsql only if nothing is set. Changing nxdbmgr init pgsql to simply nxdbmgr init allows the utility to dynamically deduce the driver from /etc/netxmsd.conf, as intended by the documentation.
- Template Mapping: Either include the dbinit_mariadb.sql template in the image build process or alias the mariadb initialization argument to use the mysql SQL template internally, since the schema structure is identical.