docker - 如何回答 dockerfile 中的安装问题?
问题描述
我尝试使用 dockerfile 安装一些东西。但是当我运行命令时,我必须回答如下问题:
进入
6
72
我的dockfile就像下面一样,但似乎不起作用。
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 中的安装问题吗?
解决方案
我测试了你的 Dockerfile 并且不需要回答任何问题,但是如果你想在运行命令时自动回答,你可以使用yes
(for "y" and "n" 响应) 或echo
.
前任:
yes | <YOUR COMMAND>
yes n | <YOUR COMMAND>
“n”响应
echo | <YOUR COMMAND>
echo 生成新行(回车)
echo "some response" | <YOUR COMMAND>
回应“一些回应”
推荐阅读
- windows-10 - 凭据提供程序接受旧的 Windows Live 帐户密码
- php - 在媒体库 Wordpress 中添加文件大小的可排序列
- python - Django,获取加载文件的完整路径
- php - 动态表格导入mysql数据库
- html - How to resize an image to fit inside a flexbox, and contain everything inside a grid of 1fr?
- sql - SQL case语句,按日期过滤,按id分组
- python - Python 请求整个 HTML 页面,而不是最初加载的内容
- lstm - 将 LSTM 与 GEKKO MPC 一起使用
- reactjs - 是否可以在 GoodDataUI 可视化中将数据限制为一个数字并将剩余数据组合为 **Others**?
- r - 根据 Shiny 中的选定行更改数据值