2017-04-03 250 views
2

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

apt install tshark中,出現以下提示。
儘管我輸入了yes,但提示停止安裝。

如何在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 

回答

0

首先,您通常需要(避免不必鍵入 '是'):

RUN apt install -yq xxx 

二:

  • 你可以看看這個tshark image,這確實安裝dumcap;通過編譯生成dumpcap的wireshark。
  • 替代(沒有編譯,只安裝)是this image

的安裝命令在該最後一種情況下變成:

# 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 
+0

我試過第一個例子'RUN apt install -yq tshark' 但是提示使得停止安裝。 – KiYugadgeter

+0

@KiYugadgeter好的。也許第二個例子在這種情況下會更好。關於第一個例子,確保使用相同的基礎圖像。 – VonC

+0

我也嘗試過第二種方式。 但顯示相同的消息。 – KiYugadgeter

0

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tshark將安裝,而無需用戶交互。