I want to create a set of containers for simulating network traffic. Inside each of the containers, I would like to set a different network delay. Right now I am doing it manually using this command, after logging into the container:

 sudo tc qdisc add dev eth0 root netem delay 128ms

I want it to be done automatically. Right now I am thinking about doing it like:

ssh root@container "my_commands"

but I am thinking about creating an instance of the container automatically (not that I am going to create many containers, each having different delay), so that later I would only have to start it.

What would be the correct way to configure it?

1 Answer 1


lxc-attach allows you to run a command in a container without logging in.

lxc-attach -n container-name -- <command>

So I guess you need to run:

lxc-attach -n container-name -- sudo tc qdisc add dev eth0 root netem delay 128ms

the output of the command, if any, is redirected to your standard outputs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .