I am trying to run a dockerfile using linux in gitlab for automatic build and learning purposes. I’m not sure how it works when trying to use a script shell file that pauses and waits for input at the command line multiple times. Is there any command to automatically send the desired inputs?
Currently when I am running the .sh file I get the following error (it is looping here):
Do you agree to the above terms and conditions? unrecognised response: ‘’
Please answer with one of: ‘yes’ or ‘no/quit’
I have run docker locally using interactive mode and this has gone well, but now it gets confusing when everything should happen automatically.
This is the docker file below. What I am doing is copying a tar file into the docker container and extracting it. There will be some files, and I want run one of them which is a .sh file (setup.sh). This will install some compiler that will be used. This .sh file will pause and ask for inputs multiple times, like install directory, reading through terms etc.
The build will get stuck at RUN /tmp/Test/Installer/setup.sh.
This line will never run at all: RUN echo “yes” | setup.sh
FROM centos
COPY ./Files /tmp/Test/
RUN cd /tmp/Test/ && tar -xvf DS500-PA-00003-r5p0-25rel0.tgz
RUN /tmp/Test/Installer/setup.sh
RUN echo "yes" | setup.sh
In order to build a container of something, you need to automate the whole configuration and installation process. You might want to ask the maintainer of the setup.sh to introduce a parameter or flag for a batch installation (as in non-interactive) that either performas an installation with default parameters or accepts a config file.
From my perspective this is rather a “how do I perform an unatended setup for this application” than a real docker problem…
Also, if you cannot have the install script changed to allow for silent installation, then see the link to Stack Exchange that I posted earlier, for other options to pass input(s). For that too, you should be able to use that without Docker before trying to include it in your Dockerfile (or create another shell script to pass the user input, and RUN that script).