The Dockerfile is as below,
FROM ubuntu
RUN apt-get update && apt-get install -y tcpdump
RUN mkdir /var/lib/tcpdump
CMD tcpdump -i eth0
You just need the below command,
docker run --tty --net=container:{{CONTAINER_NAME}} -v /var/lib/tcpdump:/var/lib/tcpdump jiaguado/tcpdump:v1 tcpdump -A 'port 8080' -w /var/lib/tcpdump/capture.pcap
As you can see you can configure your tcpdump command as you please,
https://www.tcpdump.org/manpages/tcpdump.1.html
in the sample above it will only connect traffic on 8080 and you will be able to gather the network capture on your host in /var/lib/tcpdump/
Content type
Image
Digest
Size
46 MB
Last updated
almost 6 years ago
docker pull jiaguado/tcpdump:v1