Skip to content

Commit

Permalink
tool for capturing packets from containers
Browse files Browse the repository at this point in the history
  • Loading branch information
chris468 committed Jun 27, 2024
1 parent 1a76a1f commit b454ffa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dotfiles/dot_local/bin/capture-container-network
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

tmpdir=$(mktemp -d)

docker build -t tcpdump - <<EOF
FROM ubuntu
RUN apt-get update && apt-get install -y tcpdump
ENTRYPOINT ["tcpdump", "-i", "any"]
EOF

docker run -d --rm --net container:$1 -v $tmpdir:/data tcpdump -i any -A -w /data/packets.pcap

tail -c+0 -f $tmpdir/packets.pcap | wireshark -i -

0 comments on commit b454ffa

Please sign in to comment.