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

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

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

发布评论

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

>www.elefans.com

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