tcpdump of a docker container

You create docker containers and many tools are missing. As an example: tcpdump

So I was looking for a solution for sniffing the traffic from outside of the container. It is recommended to setup an additional (tcpdump) container and to use it with following network connection:

docker pull adamoss/docker-tcpdump

docker run -ti –net=container:${id} adamoss/tcpdump port https or port http

 

You can specify different ports and save the data in a file. The id is the name of the container and the „–net=container:“ is saying that you want to have input/output traffic of the docker container like the command would be executed on the same system.