alexei-led / pumba

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

pumba netem command with docker network not working #137

Open sayankc opened 5 years ago

sayankc commented 5 years ago

Hi , My requirement is to create a docker container within a specific docker network and apply network chaos only on that network, so that other applications running on the host is not impacted. Here is what I have done. But the delay is not working. only working with --interface eth0.

  1. create a docker network. docker network create -d bridge --subnet 172.25.0.0/16 isolated_nw44

  2. Run a docker container in this network. docker run -d -p 4444:4444 -v /dev/shm:/dev/shm --name=container44 --network=isolated_nw44 --ip=172.25.3.3 selenium/standalone-chrome

  3. check the network interface created, where the docker container is. ip addr | grep 172.25 ==> inet 172.25.0.1/16 scope global br-72aff75d4744

  4. Now applying netem on the new interface (br-72aff75d4744) ./pumba_linux_amd64.v0.6.5 netem --duration 5m --interface br-72aff75d4744 --tc-image gaiadocker/iproute2 delay --time 1000 container44

Result : It is not resulting any additional delay for the URL(http://ipadderss-of-host:4444/)

  1. If I apply following command, netem is applying the delay but entire box network is impacted. ./pumba_linux_amd64.v0.6.5 netem --duration 5m --interface eth0 --tc-image gaiadocker/iproute2 delay --time 1000 container44
alexei-led commented 5 years ago

@sayankc I will check it. Did you check with network interface assigned to your container (container44) binded to isolated_nw44 network?

sayankc commented 5 years ago

hi @alexei-led , I checked with isolated_nw44 too. Same result. network delay is not reflecting for the docker network. ./pumba_linux_amd64.v0.6.5 netem --duration 5m --interface isolated_nw44 --tc-image gaiadocker/iproute2 delay --time 1000 container44

sayankc commented 4 years ago

Hi @alexei-led , Could you please let me know if it is fixed / planned to be fixed in next release.

alexei-led commented 4 years ago

Hi @sayankc Can you, please, post here output from ifconfig command running inside container44.

alexei-led commented 4 years ago

@sayankc does it work now? can I close the issue?

sayankc commented 4 years ago

@alexei-led , Issue is still there. I'll give you ifconfig.

ebcFlagman commented 2 years ago

I've the same issue. Here's my docker-compose to reproduce:

version: '3'
services:
  web:
    image: nginx
  pinger:
    image: alpine
    command: "ping web"
  pumba:
    image: gaiaadm/pumba
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: "--log-level debug netem --tc-image gaiadocker/iproute2 --duration 1m delay --time 5000 pumba-pinger-1"
GruenerT commented 11 months ago

Has there been a solution to this?

My own setup didn't work, but neither did the demo here: https://github.com/alexei-led/pumba?tab=readme-ov-file#demo

My setup is running inside windows10 wsl2.

FROM ubuntu:latest

RUN apt-get update && \
  apt-get install -y iproute2 iputils-ping net-tools socat && \
  apt-get install -y bash kmod

CMD ["socat","tcp-listen:26379,reuseaddr,fork","tcp:redis-cache-layer:6379"]

then using pumba netem --interface eth0 --duration 1h --tc-image gaiadocker/iproute2 delay --time 3000 latency-simulator

No delay is applied