MariaDB, Secrets and Unraid

Hello Everyone,

I wanted to ask how to implement the secrets function for MariaDB in Unraid.
I saw in the description:

Environment variables from files (Docker secrets)

You can set any environment variable from a file by using a special prepend FILE__ .

As an example:

-e FILE__PASSWORD=/run/secrets/mysecretpassword

Will set the environment variable PASSWORD based on the contents of the /run/secrets/mysecretpassword file.

Now I’ve created a file which contains the password.
In Unraid the template show following:

Now how can I implement the secret ?
Because the variable MYSQL_ROOT_PASSWORD is the one who should contain the password.
But how can I pass a variable as value?

You need to set variable FILE__MYSQL_ROOT_PASSWORD to the location of the password containing file inside the container

Hello,
Thanks for the answer.
I’ve modified the MYSQL_ROOT_PASSWORD variable into FILE__MYSQL_ROOT_PASSWORD
and under value the path:

But when I started the container:
No root password or too short a password ,min of 4 characters

and:cannot find secret in FILE__MYSQL_ROOT_PASSWORD

Did you create a service? https://docs.docker.com/engine/swarm/secrets/

No, as in the description it was only writte that to use the secret you had to use the : FILE__
So I though you will only have to do what you told me to do (so FILE__variablename)

I have to create a service?

I’m telling you (and the readme is telling you) how you can reference a file through that env variable scheme. That’s all. How you get that file into the container is up to you.

You can map that file manually. Docker secrets (when set up properly) also publishes files inside the container with secrets in them. Either way would work with our scheme. Setting them up is your responsibility. We’re not trying to teach you how to use docker secrets (I don’t even use them myself).

Yes, but my question was simple.
I don’t know how to do it and was hoping someone would help me doing it.
Also it should simply work with the modification I made or I misconfigured something inside the template?
I modified the variable like you suggested (adding FILE__) and setting the VALUE of the variable to the path of the file containing the password (I’ve only made a touch filename and then with nano I wrote the password and save it).

I don’t believe anyone within the team uses docker secrets. The only reason we added it was due to people using docker swarm requesting it, It should be considered an advanced user feature.

Ok I’ll try on other forums - I though maybe a user (not a team member of linuxserver.io) could know how to accomplish that.
I personally find that this feature should be at the base of dockers - since clear text password aren’t so a bright idea.
But thanks for answering.