SOT: Best Strategy For Automatize A Flow That Need User Interaction

Home » CentOS » SOT: Best Strategy For Automatize A Flow That Need User Interaction
CentOS 3 Comments

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:

# /usr/bin/mysql_secure_installation

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
… skipping.

Remove anonymous users? [Y/n] Y
… Success!

Disallow root login remotely? [Y/n] n
… skipping.

Remove test database and access to it? [Y/n] Y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
… Success!

Cleaning up…

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?

3 thoughts on - SOT: Best Strategy For Automatize A Flow That Need User Interaction

  • [snip]

    You have a urgend need to re-invent the wheel, no?

    Have a look at the offical mariab image Dockerfile, be aware that it was written with debian:latest as base:

    or, be even more clever and look at the CentOS/mariadb image:

    I hope this gives you some pointers to avoid wasting time, but, each to their own, find your pesonal way.

    Have a nice weekend.
    – Yamaban.

  • Honestly, I think your best long-term strategy for getting help with Docker is a Docker list. Personally I have no major problems with OT
    questions, but if you ask your question someplace where everyone uses
    (and maybe even develops) your software you’re much more likely to get a more complete and correct answer. On this list you’re hoping that there’s enough of a subset of users to answer your questions, and of that subset who knows how many of them really know what they’re doing.

    If the software you were asking about were some strange obscure program that few people use any more, I could see asking everywhere you could on the off-chance that someone knows about it. But for something so popular like Docker there’s no reason to go away from their discussion forums.


  • No problem Keith, I will move this discussion to Docker google groups and perhaps I will get a better answer :-) thanks for your suggestion Cheers