Skip to content

Instantly share code, notes, and snippets.

@drmuey
Last active November 20, 2020 15:01
Show Gist options
  • Save drmuey/83bf6c28831268ba1fb586ccd9a86343 to your computer and use it in GitHub Desktop.
Save drmuey/83bf6c28831268ba1fb586ccd9a86343 to your computer and use it in GitHub Desktop.

Note: If you are using podman feel free to s/docker/podman/g it should work the same.

  1. Ensure that container1 has the NET_ADMIN capability
    • docker inspect --format='cap_add: {{.HostConfig.CapAdd}}' container1
  2. Install tc on container1:
    • apt-get install libterm-readline-perl-perl -y && apt-get update && apt-get install iproute2 iputils-ping -y
  3. Configure latency on the container1:
    • tc qdisc add dev eth0 root netem delay 1000ms
  4. verify there is latency between two images:
    • docker exec container2 ping container1
    • Note: if container2 does not have pingdocker exec -u 0 container2 bash -c "apt-get update && apt-get install iproute2 iputils-ping -y"

For items 2 and 3 you can run those either:

  • one off: docker exec -u 0 container1 bash -c "<CMD>"
  • in a shell: docker exec -u 0 -it container1 bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment