Note: If you are using podman
feel free to s/docker/podman/g
it should work the same.
- Ensure that
container1
has theNET_ADMIN
capabilitydocker inspect --format='cap_add: {{.HostConfig.CapAdd}}' container1
- Install
tc
oncontainer1
:apt-get install libterm-readline-perl-perl -y && apt-get update && apt-get install iproute2 iputils-ping -y
- Configure latency on the
container1
:tc qdisc add dev eth0 root netem delay 1000ms
- verify there is latency between two images:
docker exec container2 ping container1
- Note: if
container2
does not haveping
➜docker 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