You edit a config file, restart, and nothing changes. Before doubting the setting, check whether the server reads your line at all.
This tool collects the options exactly as the server would from its option files:
my_print_defaults --mysqld
Each option comes out as a command line argument, in the order read. With several files in play, the same setting can appear twice, and the one further down wins. That alone explains plenty of “but I set it” mysteries.
To see which files are searched, and in what order, ask for its help text:
my_print_defaults --help
For the client programs, name their groups instead:
my_print_defaults client mariadb
In a container, run it with docker exec and your container name, which is also a good way to confirm that a mounted .cnf file arrived where you thought it did. If your line is missing, check that the file name ends in .cnf, sits in an included directory and puts the setting under a group header such as [mariadb].
It reads files only. Options given on the server’s command line, such as extra arguments in a compose file, are not listed, and neither are values changed at runtime with SET GLOBAL. For the value in force right now, SHOW GLOBAL VARIABLES LIKE 'max_connections'; has the last word. I’d also keep passwords out of shared output, since a [client] section may contain one.
Further reading: my_print_defaults documentation, Configuring MariaDB with option files