Docker Community Forums

Share and learn in the Docker community.

How to provide user input when running in non-interactive mode?

I tried to install netcat like this but it fails since I am not able to answer the question. Is there any way to specify the answer for the prompt without having to run in interactive mode?

$ docker exec nginx apt-get install netcat
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  netcat-traditional
The following NEW packages will be installed:
  netcat netcat-traditional
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 75.9 kB of archives.
After this operation, 156 kB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
$

apt-get install -y netcat?

Thanks. I didn’t know about that.

Thanks for sharing such valuable information!!

The Docker build process is completely non-interactive. There is currently no way to anyswer questions or making interactive decisions during the build phase. While almost all linux apps support a full comand-line installation (non-interactive) windows apps lack those quite often…