如何回答 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
我的停靠文件如下所示,但似乎无法正常工作.
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 "
" }
RUN apt-get -y install php7.1 php7.1-fpm
expect "Please select the geographic area in which you live. " { send "6
" }
expect "Please select the city or region corresponding to your time zone. " { send "72
" }
RUN -y apt-get install nginx
有人告诉我如何回答 dockerfile 中的安装问题吗?
Anyone tell me how to answer install question in dockerfile?
推荐答案
我测试了你的 Dockerfile 并没有回答任何问题,但是如果你想在运行命令时自动回答,你可以使用 是
(用于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"响应
回声 |<YOUR COMMAND>
echo 生成新行(回车)
echo | <YOUR COMMAND>
echo generate a new line (enter)
echo "一些响应" |<YOUR COMMAND>
带有一些响应"的响应
echo "some response" | <YOUR COMMAND>
response with "some response"
这篇关于如何回答 dockerfile 中的安装问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!