0

I'm trying to execute this script https://repo.anaconda.com/miniconda/Miniconda3-py38_23.1.0-1-Linux-x86_64.sh in a Dockerfile.

# I have already downloaded the file
RUN bash Miniconda3-py38_23.1.0-1-Linux-x86_64.sh

When I launch it I got this error:

RUN bash Miniconda3-py38_23.1.0-1-Linux-x86_64.sh:
#0 0.411 
#0 0.411 Welcome to Miniconda3 py38_23.1.0-1
#0 0.411 
#0 0.411 In order to continue the installation process, please review the license
#0 0.411 agreement.
#0 0.411 Please, press ENTER to continue
#0 0.411 >>>

I found here that you can add yes '' before your script to "auto confirm"

# I have already downloaded the file
RUN yes | bash Miniconda3-py38_23.1.0-1-Linux-x86_64.sh

But when I do this I got:

RUN yes '' | bash Miniconda3-py38_23.1.0-1-Linux-x86_64.sh                                                                                                                                                               6.5s
 => => # >>> Please answer 'yes' or 'no':'                                                                                                                                                                                             
 => => # >>> Please answer 'yes' or 'no':'                                                                                                                                                                                             
 => => # >>> Please answer 'yes' or 'no':'                                                                                                                                                                                             
 => => # >>> Please answer 'yes' or 'no':'                                                                                                                                                                                             
 => => # >>> Please answer 'yes' or                                                                                                                                                                                                    
 => => # [output clipped, log limit 200KiB/s reached]

Is there a way to tell bash to run this script in a non interactive mode and accept default parameters by default ?

Lenny4
  • 1,215
  • 1
  • 14
  • 33
  • Can you edit the script to not `read` input? The bash interpreter itself doesn't have any notion of "default parameters" in response to interactive questions like these. – David Maze Mar 04 '23 at 19:44

2 Answers2

0

RUN yes '' | ...

That invocation of yes produces empty strings.

% yes '' | head -n 1

You want it to say 'yes' so you should actually specify that.

% yes 'yes' | head -n 1                                                                                                                                                                   
yes
erik258
  • 14,701
  • 2
  • 25
  • 31
0

Do:

RUN bash Miniconda3-py38_23.1.0-1-Linux-x86_64.sh -b

See Miniconda3-py38_23.1.0-1-Linux-x86_64.sh -h

KamilCuk
  • 120,984
  • 8
  • 59
  • 111