如何在Docker上安装tshark?

我想在Docker for Mac上使用Dockerfile在ubuntu17.04上安装tshark。 我正在使用docker-compose

apt install tshark ,出现以下提示。
提示停止安装,尽pipe我inputyes

如何在Dockerfile中安装tshark?

 Dumpcap can be installed in a way that allows members of the "wireshark" system group to capture packets. This is recommended over the alternative of running Wireshark/Tshark directly as root, because less of the code will run with elevated privileges. For more detailed information please see /usr/share/doc/wireshark-common/README.Debian. Enabling this feature may be a security risk, so it is disabled by default. If in doubt, it is suggested to leave it disabled. Should non-superusers be able to capture packets? [yes/no] yes 

首先,你通常有(为了避免input“是”):

 RUN apt install -yq xxx 

第二:

  • 你可以看看这个安装dumcap的tshark映像 ; 通过编译生成dumpcap的wireshark。
  • 替代scheme(不编译,只安装)就是这个图像

安装命令成为最后一种情况:

 # Install build wireshark, need to run as root RUN apt-get update && \ apt-get install -y wireshark && \ groupadd wireshark && \ usermod -aG wireshark developer && \ setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap && \ chgrp wireshark /usr/bin/dumpcap && \ chmod 750 /usr/bin/dumpcap 

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tshark将安装而不需要用户交互。