How to make docker give opportunity to answer prompts during dockerfile installation?


I am working on a Dockerfile and have got it to run the shell script on my Ubuntu system. However, it appears that the build fails; without docker, I would get the opportunity to answer about 11 prompts during installation. How can I make docker pause to give me the opportunity to answer the prompts? The following is an example of my file:

Thanks for any help in advance


Why not create a script and ask questions there then using build arguments, pass values to your dockerfile ?

Or still in bash, ask for questions, write a .env file with key value like INSTALL_MYSQL=true and use that env file during the build.

1 Like

Using the env DEBIAN_FRONTEND=noninteractive should select the defaults without manually giving you a prompt. So, that way, your intervention is not needed during the image-building process.

1 Like

All answers before me were good, but it all depends on what the prompt is. Normally you would not want to have any prompt as you are not there when a image is automatically built in a CI/CD pipeline.

If the application doesn’t support any way to receiev the parameters, except interactively, that is not designed to run in containers.

Usually you can send the answers to the standard input of a command to not ask for inputs interactively, but better if it has command lines arguments for the same questions. And there is also a command called “Expect” to help you automate interactive questions

It all depends on the app and the questions. Try @capriciousduck’s answer first, which helps if the app recognizes the variable and can work with default parameters, but not if it requires those parameters.