Dockerfile - 如何在apt-get安装后传递答案给提示框?

32
在我的 Dockerfile 中,我正在尝试安装 jackd2 包:
RUN apt-get install -y jackd2

安装过程顺利进行,但是安装后我看到了以下提示:

If you want to run jackd with realtime priorities, the user starting jackd
needs realtime permissions. Accept this option to create the file
/etc/security/limits.d/audio.conf, granting realtime priority and memlock
privileges to the audio group.

Running jackd with realtime priority minimizes latency, but may lead to
complete system lock-ups by requesting all the available physical system
memory, which is unacceptable in multi-user environments.

Enable realtime process priority? [yes/no]

此时,我想回答是或否,然后按回车键继续,但我不知道如何在dockerfile中编写脚本,我的构建在那里挂起。


4
尝试过运行 yes | apt-get install -y jackd2 命令吗? - kichik
@kichik 可能需要 yes yes | apt-get ... - Andreas Louv
我已经尝试了两种方法,但都没有起作用。此外,我可能不得不回答“不行”。 - Paweł Duda
1
根据您的使用情况,您可以从基础镜像开始,手动安装jackd2,使用docker commit将容器转换为新镜像,并将该新镜像用作Dockerfile的基础。 - meatspace
1个回答

23

这个答案 解释了 "自动应答" 和非交互模式之间的差异。

我还发现一个安装jackd2镜像的Dockerfile示例 在这里,在安装jackd2之前将DEBIAN_FRONTEND设置为'noninteractive'


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接