Dockerfile 中的交互式命令 [英] Interactive command in Dockerfile

查看:74
本文介绍了Dockerfile 中的交互式命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带有适当 Dockerfiledocker build 命令自动创建开发 Docker 映像.我需要在 RUN 命令中运行的脚本之一希望用户单击并阅读他们的许可协议.因此有两个问题:

I'm trying to automate a creation of a development Docker image using docker build command with appropriate Dockerfile. One of the scripts that I need to run in a RUN command wants the user to click through and read their license agreement. Thus there are two questions:

  1. Dockerfile 中所有 RUN 命令的输出在哪里?
  2. 有什么解决方案可以与上述命令进行交互?现在 docker build 命令只是卡在无限循环中询问用户输入.
  1. Where is the output of all the RUN commands in a Dockerfile?
  2. What solution is possible to interact with the aforementioned command? Right now the docker build command just gets stuck asking user for input in an infinite loop.

推荐答案

在构建过程中,RUN 命令的输出会显示在您的终端中.Docker 构建过程是完全非交互式的,因此您必须找到某种方式来自动接受这些条款(几乎每个软件都允许这样做,想想 apt-get install -y...)或使用一些 shell 巫术将接受回传给流程或其他任何东西(Expect 可能?).

The output of RUN commands is shown in your terminal during the build. The Docker build process is completely non-interactive, so you must find some way of either auto-accepting the terms (almost every piece of software allows this, think apt-get install -y...) or using some shell wizardry to echo the acceptance back to the process or whatever (Expect maybe?).

这篇关于Dockerfile 中的交互式命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆