【问题标题】:How to install tshark on Docker?如何在 Docker 上安装 tshark?
【发布时间】:2017-04-03 04:32:45
【问题描述】:

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

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

【问题讨论】:

    标签: docker installation dockerfile tshark docker-for-mac


    【解决方案1】:
    RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tshark
    

    无需用户交互即可安装。

    【讨论】:

    • 不知道为什么,但是如果我在软件包列表的末尾有 tshark 来安装它就不起作用。如果我有它作为一个,完美的工作: RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y tshark RUN apt-get update && apt-get install -y git python python-pip iputils-ping traceroute跨度>
    • @Tomasz 我遇到了同样的问题,你找到它为什么会这样的原因了吗?
    【解决方案2】:

    首先,您通常需要(避免输入“是”):

    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
    

    【讨论】:

    • 我试过第一个例子RUN apt install -yq tshark但是提示停止安装。
    • @KiYugadgeter 好的。在这种情况下,也许第二个例子会更好。关于第一个示例,请确保使用相同的基本图像。
    • 我也尝试过第二种方式。但显示相同的消息。
    猜你喜欢
    • 2012-01-04
    • 2018-04-21
    • 2020-04-07
    • 2017-05-12
    • 1970-01-01
    • 2022-09-27
    • 2018-09-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多