gpt4 book ai didi

docker - Docker:安装期间的Echo输入

转载 作者:行者123 更新时间:2023-12-02 21:33:42 26 4
gpt4 key购买 nike

我是Docker的新手,需要安装一个在安装过程中需要大量输入的文件。
在普通的bash脚本中,我将回显命令以填充输入。如何模仿dockerfile中的行为?
这是我的脚本:

#: Copy CPLEX installer binary from S3.
COPY cplex_odee1210.linux-x86-64.bin /setup/



#: Install CPLEX and update .bashrc
RUN chmod +x /setup/cplex_odee1210.linux-x86-64.bin
RUN bash cplex_odee1210.linux-x86-64.bin
RUN echo 2 #: - Press 2 for english
RUN echo -ne '\n' #: - Press ENTER to confirm prompt
RUN echo -ne '\n' #: - Press ENTER to continue
RUN echo 1 #: - Press 1 to accept license agreement
RUN echo -ne '\n' #: - Press ENTER to confirm prompt
RUN echo -ne '\n' #: - Press ENTER to accept default path
RUN echo -ne '\n' #: - Press ENTER to install
RUN echo -ne '\n' #: - Press ENTER to continue
RUN echo -ne '\n' #: - Press ENTER to continue
RUN echo 2 #: - Press 2/ENTER to say no to product usage data collection
RUN echo -ne '\n' #: - Press ENTER to confirm prompt
RUN echo -ne '\n' #: - Press ENTER to exit the installer
RUN echo 'export PATH=$PATH:/opt/ibm/ILOG/CPLEX_Optimizer1210/cplex/bin/x86-64_linux' >>~/.bashrc
RUN source ~/.bashrc
这是运行的内容,但是并没有超过此步骤:
Step 9/54 : RUN bash cplex_odee1210.linux-x86-64.bin
---> Running in c6404632b1b0
Preparing to install
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

===============================================================================
Choose Locale...
----------------

1- Deutsch
->2- English
3- Espa?ol
4- Fran?ais
5- Portugu?s (Brasil)

CHOOSE LOCALE BY NUMBER:
我需要将bash run命令链接在一起吗?有没有办法做到这一点?

最佳答案

在Dockerfile中,每个RUN语句均按顺序执行。如前所述,您无法运行交互式程序,并且需要以其他方式传递输入(如果您无法重构程序,则可以使用Shell重定向来从文件或使用Heredoc提供输入) 。

关于docker - Docker:安装期间的Echo输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63948408/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com