如何回答dockerfile中的安装问题? [英] How to answer install question in dockerfile?
问题描述
我尝试使用dockerfile安装某些东西。
但是当我运行命令时,我必须回答以下问题:
I tried to install something using dockerfile. But when I run the command, I have to answer the question like following:
输入
6
72
我的dockfile如下所示,但似乎不起作用。
My dockfile is like following, but seems not working.
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y expect
RUN apt-get -y install software-properties-common
RUN apt-add-repository ppa:ondrej/php
expect "Press [ENTER] to continue or Ctrl-c to cancel adding it. " { send "\n" }
RUN apt-get -y install php7.1 php7.1-fpm
expect "Please select the geographic area in which you live. " { send "6\n" }
expect "Please select the city or region corresponding to your time zone. " { send "72\n" }
RUN -y apt-get install nginx
有人告诉我如何回答dockerfile中的安装问题吗?
Anyone tell me how to answer install question in dockerfile?
推荐答案
我测试了您的Dockerfile,而不必回答任何问题,但是如果您想在运行命令时自动回答,则可以使用 yes
(用于 y和 n响应)或 echo
。
I tested your Dockerfile and didn't have to answer any question, but if you want to auto answer when you run a command, you can use yes
(for "y" and "n" responses) or echo
.
例如:
是| <您的命令>
是n | <您的命令>
n响应
回声| <您的命令>
echo生成新行(输入)
echo | <YOUR COMMAND>
echo generate a new line (enter)
echo some response | < YOUR COMMAND>
带有某些响应的响应
这篇关于如何回答dockerfile中的安装问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!