2

您如何dpkg-reconfigure wireshark-common在 Dockerfile 中执行操作?

我的 Docker 文件包含: RUN apt-get install wireshark --yes

但是这--yes不影响这dpkg-reconfigure wireshark-common一步,所以我不清楚如何对屏幕上的问题回答“是”甚至“否” Should non-superusers be able to capture packets?

4

2 回答 2

4

尝试使用yes命令。

RUN yes | dpkg-reconfigure wireshark-common

您可以做的另一个尝试是:

RUN echo "y" | dpkg-reconfigure wireshark-common

现在不确定wireshark在dpkg-reconfigure上的要求是什么……但是使用这种技术,您可以发送“y”或“1”或您需要的任何内容。

根据您在此处的评论,另一种可能的解决方案:

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wireshark

使用最后一个,您将跳过任何交互式安装后配置步骤。

于 2017-05-21T08:44:11.183 回答
0

有了第一个答案,我无法以非 root 身份运行 tshark。这是我的解决方案,它接受“dpkg-reconfigure wireshark-common”的“是”回答,因此您可以以普通用户身份运行 tshark:

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tshark
RUN yes yes | DEBIAN_FRONTEND=teletype dpkg-reconfigure wireshark-common
RUN usermod -a -G wireshark yourUserName

将“yourUserName”替换为允许运行 tshark 的用户。

于 2019-11-22T09:53:09.170 回答