Created
March 17, 2016 13:05
-
-
Save jgraglia/e7d871bf26e12d99b446 to your computer and use it in GitHub Desktop.
Docker : launch wireshark on a container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://github.com/crccheck/docker-tcpdump | |
#docker ps format help https://docs.docker.com/engine/reference/commandline/ps/#format | |
# IPT : https://github.com/ruyadorno/ipt | |
function dshark { | |
if [ $# == 0 ]; then | |
CONTAINER=`docker ps --format='table {{.ID}} | {{.Names}} | {{.Command}}' | ipt | cut -d '|' -f 1` | |
if [ "$$CONTAINER" == "" ]; then | |
echo "Missing docker container: $CONTAINER" | |
return 1 | |
fi | |
else | |
CONTAINER=$1 | |
fi | |
echo "Will launch Wireshark capture on container $CONTAINER" | |
docker ps --filter "id=$CONTAINER" | |
docker run --rm --net=container:$CONTAINER crccheck/tcpdump -i any --immediate-mode -w - | wireshark -k -i - | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment