I am working in a Dockerfile but there is a “secure” MariaDB server script I need to run which is interactive and I don’t know how to deal with this.
Basically this is the flow I have follow on the script at test environment and is the same I want to achieve in the Dockerfile without user interaction by just answering as you seen on the flow below:
Enter current password for root (enter for none): [ENTER] // because there is no password
OK, successfully used password, moving on…
Set root password? [Y/n] n
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] Y
– Dropping test database…
– Removing privileges on test database…
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
So I need to write a bash script or something else that could handle this automatically but has not idea, how would you take care of this?