alexei-led / pumba

Chaos testing, network emulation, and stress testing tool for containers
Apache License 2.0
2.75k stars 193 forks source link

command 'tc' failed in /TargetContainer #215

Closed steppangit closed 2 years ago

steppangit commented 2 years ago

Running pumba directyl in ubuntu 20.04.

Do you have any idea what I am missing?

Error Message is: sudo pumba -l info netem --duration 15s delay --time 5000 TargetContainer INFO[0000] Running netem command '[delay 5000ms 10ms 20.00]' on container c0d333418a6e15508d6a3a89d6872079a0a2277b19a7451fdaaf4633a50114b2 for 15s app=pumba function=github.com/alexei-led/pumba/pkg/container.dockerClient.NetemContainer source=container/client.go:220 INFO[0000] start netem for container app=pumba dryrun=false function=github.com/alexei-led/pumba/pkg/container.dockerClient.startNetemContainer id=c0d333418a6e15508d6a3a89d6872079a0a2277b19a7451fdaaf4633a50114b2 iface=eth0 name=/TargetContainer netem=delay 5000ms 10ms 20.00 source=container/client.go:276 tcimage= ERRO[0003] command exited with error app=pumba exit=2 function=github.com/alexei-led/pumba/pkg/container.dockerClient.execOnContainer source=container/client.go:551 ERRO[0003] command 'tc' failed in /TargetContainer (c0d333418a6e15508d6a3a89d6872079a0a2277b19a7451fdaaf4633a50114b2) container; run it in manually to debug app=pumba function=github.com/alexei-led/pumba/pkg/container.dockerClient.NetemContainer source=container/client.go:227 ERRO[0003] failed to start netem for container app=pumba error=command 'tc' failed in /TargetContainer (c0d333418a6e15508d6a3a89d6872079a0a2277b19a7451fdaaf4633a50114b2) container; run it in manually to debug function=github.com/alexei-led/pumba/pkg/chaos/netem.runNetem source=netem/netem.go:26 ERRO[0003] failed to delay network for container app=pumba error=command 'tc' failed in /TargetContainer (c0d333418a6e15508d6a3a89d6872079a0a2277b19a7451fdaaf4633a50114b2) container; run it in manually to debug function=github.com/alexei-led/pumba/pkg/chaos/netem.(*DelayCommand).Run source=netem/delay.go:178 ERRO[0003] failed to run chaos command app=pumba error=command 'tc' failed in /TargetContainer (c0d333418a6e15508d6a3a89d6872079a0a2277b19a7451fdaaf4633a50114b2) container; run it in manually to debug function=github.com/alexei-led/pumba/pkg/chaos.RunChaosCommand source=chaos/command.go:79 FATA[0003] command 'tc' failed in /TargetContainer (c0d333418a6e15508d6a3a89d6872079a0a2277b19a7451fdaaf4633a50114b2) container; run it in manually to debug app=pumba function=main.main source=cmd/main.go:201

steppangit commented 2 years ago

159 which has been closed without a solution seems to be a similar issue.

Unfortunately I can't find any solutions. TC does not work even with tc-image and commands from your own readme. Could this be related to the host docker api running on windows?

steppangit commented 2 years ago

I found out that this is purely a windows issue. WSL 2 currently does not support tc with sch_netem. If you really need to get this going with windows you need to compile and provide a custom kernel for WSL 2. Works right away with Linux as a host.