如何回答dockerfile中的安装问题?

编程入门 行业动态 更新时间:2024-10-27 03:31:33
本文介绍了如何回答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中的安装问题?

本文发布于:2023-10-04 18:03:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1467196.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:dockerfile

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!