gacanepa
gacanepa

Reputation: 343

How do I write a Dockerfile to run an interactive application?

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.

Upvotes: 1

Views: 1262

Answers (1)

asamarin
asamarin

Reputation: 1594

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

Upvotes: 1

Related Questions