Mariadb - creation with docker secrets not working

Likely your secret has a trailing newline
Use printf to create it, not echo