1

I'm fairly new to Docker, so please bear with me.

I need to understand how to write a Dockerfile that can run an interactive application, such as mysql_secure_installation (which allows the user to change root's password and indicate if the privilege tables should be flushed, for example).

PS: I know how to do the same when the application does not require interaction, as explained here.

Community
  • 1
  • 1
gacanepa
  • 323
  • 4
  • 16

1 Answers1

1

Your best bet will probably be to delegate control to an expect(1) script from a RUN directive in your Dockerfile. For example:

Dockerfile

FROM debian:latest
...
RUN mysql_secure_install.sh
...

mysql_secure_install.sh

Grab inspiration from the accepted answer on this SO thread

Community
  • 1
  • 1
asamarin
  • 1,544
  • 11
  • 15