Sign inSign up

terorie/netem-agent

By terorie

•Updated almost 7 years ago

Image
0

443

terorie/netem-agent repository overview

⁠Docker netem agent

netem-agent is a container that artificially slows down a Docker network. I use it to test the behavior of distributed systems when exposed to real-world networking conditions.

  • Easily emulate properties of WANs in a Docker network via netem⁠
    • Delay packets with jitter
    • Introduce packet loss, reordering, etc.
  • Works in Swarm mode, Requires no special preparation of the target containers
    • Unlike e.g. pumba⁠, a powerful chaos-testing tool which needs the iproute2 package in the target containers.
  • Relies on standard Linux tooling
⁠How does it work?

It uses dockerveth⁠ in the host network context to map all selected containers to their veth interfaces.

Then, it activates the NetEm traffic control facilities on those interfaces.

⁠Configuration

Requirements:

  • Linux machine
  • Preparation of target containers not required
  • Access to the Docker daemon
  • NET_ADMIN capability on agent and elevated privileges (TODO Make it work with less privileges)
  • Access to Docker network namespaces
  • Host networking enabled on agent
  • Running as regular Docker container, not Swarm service

Example:

docker run -it --rm \
  --name netem-agent \
  --cap-add=NET_ADMIN \
  --privileged \
  --net=host \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v /var/run/docker/netns:/var/run/netns:ro \
  terorie/netem-agent \
  --name='^dummy.*' \
  --delay=100ms \
  --jitter=50ms
⁠Options
  • --interval Update interval
  • --name Container name regex filters (optional, by default delaying all containers)
  • --delay Outgoing packets delay
  • --jitter Delay jitter
  • --delete Delete all delays and exit

⁠Attributions

Tag summary

Content type

Image

Digest

Size

68 MB

Last updated

almost 7 years ago

docker pull terorie/netem-agent