Installing traffic control on a docker container

130 Views Asked by At

I'm trying to use traffic control (tc) in my docker container. However it does not find it.

I have installed iproute with yum

yum install iproute -y

I thought it should include traffic control (tc) commands. However it does not. I thought maybe it is in a different package (as it was suggested here and there). But none of these work:

yum install iproute -y
yum install iproute-tc -y
yum install iproute2 -y
yum install tc -y

My disto:

# cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
VERSION="8.9 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.9"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.9 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"

Ultimately I want to use the docker image as a stub where I can send traffic too and respond with delays (to do small scale load/stress testing). Traffic control is a powerfull tool to artifically create latency.

1

There are 1 best solutions below

2
datawookie On

I tried to get this to work using the UBI Red hat image but was not successful.

However, it works with a Fedora base image, which is essentially Red Hat.

Dockerfile

FROM fedora:40

RUN dnf update -y && dnf install -y iproute-tc

Build and run.

docker build -t fedora-tc .
docker run -it fedora-tc

enter image description here