DockerSelf-Hosting

Pumba with Docker: Kill Containers and Slow the Network to See What Breaks (Linux, Windows, Mac)

Before you start

  • 26 min read

Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#

Pumba is a free command-line tool that breaks your Docker containers on purpose: it can kill, stop, pause or remove them, add network delay or packet loss, and stress the CPU. You run it against a lab copy of your setup to find out what really happens before a real failure does it for you.

Pumba official logo

Logo: the official Pumba project (github.com/alexei-led/pumba, file docs/img/pumba_logo.png), Apache-2.0 (resized to 480 px wide)

Most homelabs have a restart: unless-stopped line and a feeling that "it will come back". We build a small lab and test it: does a killed container come back, does docker-autoheal fix a container that turned unhealthy, and does an app survive a 300 ms delay on its way to its database? Reading the Docker source surprised us (Step 4), so run the tests before you trust anything.

WhatValue (official sources, read 5 December 2026)
Current versionPumba 1.6.0, released 5 November 2026 (GitHub marks it "Latest")
Image to pinghcr.io/alexei-led/pumba:1.6.0 (tag checked on ghcr.io; linux/amd64 and linux/arm64)
LicenceApache-2.0 (GitHub repository data and LICENSE at the tag)
Time neededAbout 45 minutes (our estimate, not measured)
PortsNone. Pumba has no web page and listens on nothing
Official docsREADME, user guide, network chaos guide

At a glance:

  • What it does: container chaos (kill, stop, pause, rm, restart, exec), network chaos (netem delay and loss, iptables packet loss) and stress.
  • Where it runs: Linux. The project says Windows is "not supported and not planned"; the Mac binary only drives a Docker that runs elsewhere. We use the container image on a Linux lab host.
  • What it needs: the Docker socket, which is root-level power over the host. A lab tool (see Security).
  • Safety built in: --dry-run, --max-targets, selection by label, and a label (com.gaiaadm.pumba.skip=true) that protects a container from ever being chosen.
  • Not a scanner: it breaks things. Our Trivy guide covers security scanning.

Honest status. We did not run any of this on a real machine. Commands come from the developer's docs and source at tag 1.6.0, read on 5 December 2026. "We expect" means our reading, not a result. Pumba shipped five releases between 29 October and 5 November 2026 (1.3.0 to 1.6.0): pin the version.

How it fits together#

You start Pumba as a throw-away container with the Docker socket. It asks Docker to kill or exec into one labelled container, or to start a helper that shares that container's network and adds the delay. The database has a skip label, so Pumba can never pick it.

Pumba flow: you run a Pumba command in a throw-away container, which sends API calls to the Docker Engine through the socket; the engine runs the restart policy and receives restart requests from autoheal; the engine kills or runs a command in the single labelled target container lab-app, or starts a temporary netem helper that adds 300 milliseconds to the traffic from lab-app to the protected database lab-db

Drawn for this guide from the official docs. The dashed boxes exist only while a network test runs.

Two words. A helper (the docs say "sidecar") is a short-lived container that joins the target's network to run tc, so your own image needs no tools. netem is Linux's network emulator; it changes outgoing packets only. Incoming packets are the job of the iptables command.

Before you start#

Note: every password, domain and name on this page is a dummy example (like change-me). Replace it with your own and keep real secrets out of Git. Use these tests only on a lab copy, never on the only copy of your data.

You need a Linux machine or VM that is allowed to break.

SystemWhat to have
LinuxDocker Engine 18.06 or newer (the Pumba prerequisite) and the Compose plugin
WindowsA Linux VM or spare box is the safe route. Docker Desktop (WSL 2) is not documented by Pumba
MacThe same: Pumba's Mac binary only talks to a remote engine
Run in terminalbash
docker --version
docker compose version

Checklist:

  • [ ] Both commands print a version
  • [ ] This host is a lab: nothing on it that you cannot rebuild
  • [ ] Your real compose files are backed up (we never touch them)
  • [ ] You have read the Security section (Docker socket)
  • [ ] Already running autoheal from our guide? Keep only one copy

Tested by DIY Lab Hub: not yet (Linux, Windows and Mac: not run).

Tip: Use a spare VM, not the machine that holds your family's photos. A wrong rm costs nothing there.

LLM Guide: let your AI assistant set it up#

Prefer to let an AI do the typing? Copy the block below into ChatGPT, Claude, Gemini or a local model. It first asks about your setup (system, Docker, lab machine), then follows only the path that fits you. It uses the same pinned versions as this guide. You still read each command before you run it.

Instructions for your AI assistantllm
You are my assistant for setting up a small chaos-testing lab with Pumba (kills containers, adds network delay) on Docker.
Follow the DIY Lab Hub guide https://diylabhub.com/pumba/ (checked 5 December 2026).
Work one step at a time. Before each command, say in one line what it does. Wait for my OK before anything that deletes data, stops a service, changes my router or opens a port.

STEP 0 - FIND OUT MY SETUP. Ask me these questions (or have me run the read-only checks) before you do anything else:
1. Which machine is the LAB? It must be a Linux machine or VM that is allowed to break, with nothing on it I cannot rebuild. Pumba needs Docker Engine 18.06 or newer. On Windows or Mac, Docker Desktop is not documented by Pumba: the safe route is a Linux VM or spare box (Pumba's Mac and Windows binaries only talk to a remote engine with --host).
2. Is Docker with the Compose plugin installed? Check: docker --version and docker compose version
3. Is anything else already running on this host that matters (family photos, real services)? If yes, stop: use another machine.
4. Do I already run docker-autoheal? Keep only one copy.
5. Did I read the guide's Security section? Explain it: the Docker socket gives root-level power over the host, and Pumba can kill, exec into, remove and create containers.

THEN FOLLOW THE MATCHING PATH:
- Docker missing: install Docker Engine + Compose plugin from docs.docker.com first.
- Pumba has no web page and opens no port, so there is no HTTPS, Traefik or Caddy part; never expose the Docker API on plain TCP (for a remote engine use --tls / --tlsverify).
- Windows or Mac host: only through a Linux VM; do not run the socket mount on Docker Desktop (untested in the guide).

STEP 1 - FOLDERS, SECRETS AND A WRAPPER (folder ~/docker_volumes/pumba with data, config, logs, backups):
.env holds DB_PASSWORD=change-me (a dummy; I replace it with my own) and AUTOHEAL_IMAGE set to the digest of willfarrell/autoheal (docker pull willfarrell/autoheal:latest once, then read the digest with docker image inspect --format '{{index .RepoDigests 0}}'); chmod 600 .env.
A wrapper script pumba.sh runs Pumba as a throw-away container with the label com.gaiaadm.pumba=true (so Pumba never selects itself):
exec docker run --rm --label com.gaiaadm.pumba=true -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/alexei-led/pumba:1.6.0 "$@"

STEP 2 - THE LAB (compose.yaml, no "version:" line; compose needs $ written as $$): three services.
  db (lab-db):
    image: postgres:17.12
    user app, database appdb, password from DB_PASSWORD, data ./data:/var/lib/postgresql/data, healthcheck pg_isready, label com.gaiaadm.pumba.skip: "true" (Pumba must never pick it).
  app (lab-app):
    image: postgres:17.12
    entrypoint bash -c, a loop that runs "select 1" every second and prints "ok <n> ms" or FAIL, trap 'exit 1' TERM, a /tmp/healthy file for its healthcheck, labels lab.chaos: "app" and autoheal: "true", depends_on db healthy.
  autoheal (lab-autoheal):
    image: ${AUTOHEAL_IMAGE}
    network_mode none, AUTOHEAL_CONTAINER_LABEL autoheal, interval 10, socket mounted.
Write it exactly as in the guide's Step 2 (if you can open the guide, copy that file). Check with docker compose config -q, then docker compose up -d and docker compose ps.

STEPS 3 TO 8 - THE EXPERIMENTS (always --dry-run first, always --max-targets 1, target by label and name):
- Preview: ./pumba.sh --dry-run --log-level info --label lab.chaos=app --max-targets 1 kill lab-app. The helper image for network delay is ghcr.io/alexei-led/pumba-alpine-nettools:sha-2d64fca (pinned, no numbered tags).
- Kill: Pumba's kill switches the restart policy off, so lab-app stays down (Exited 137). A real crash (exec kill -TERM 1) is what the restart policy brings back; check docker inspect --format '{{.RestartCount}}' lab-app.
- Unhealthy: exec rm /tmp/healthy in lab-app; autoheal restarts it after the next 10-second pass.
- Delay: ./pumba.sh --label lab.chaos=app --max-targets 1 netem --tc-image ghcr.io/alexei-led/pumba-alpine-nettools:sha-2d64fca --target lab-db --duration 60s delay --time 300 lab-app (the time is in milliseconds), while docker logs -f lab-app runs in a second terminal.
- Cleanup: check for leftovers (the guide's "leftovers" step and Pumba's finding-leftovers docs) and run docker compose down when done. Never run "pumba rm" without --force=false --volumes=false.

CHECK IT WORKED: ./pumba.sh --version prints 1.6.0; docker compose ps shows lab-db and lab-app healthy and lab-autoheal running after about 30 seconds; docker logs --tail 5 lab-app prints lines like "<time> ok <n> ms" (my baseline); the first dry-run names lab-app and nothing else.

RULES FOR YOU:
- Use only the versions above. Do not use the deprecated Docker Hub image gaiaadm/pumba or :latest tags, and do not invent Pumba flags: run ./pumba.sh --help and the subcommand --help first (flags like --interval go before the subcommand; --time is in milliseconds). If a step fails, show me the exact error and read https://github.com/alexei-led/pumba before guessing.
- Run chaos only on this lab, never on a machine with data I cannot rebuild.
- Values like change-me are placeholders; I choose my own.
- Never ask me to paste passwords, tokens or keys into this chat.

Step 1: Create the folders, the secrets file and a Pumba wrapper#

Everything lives under ~/docker_volumes/pumba. The .env file holds the lab database password (a dummy, change-me: replace it) and the autoheal image. We pin autoheal by digest like our autoheal guide does; latest appears only to read that digest once.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/pumba/{data,config,logs,backups}
cd ~/docker_volumes/pumba
printf 'DB_PASSWORD=change-me\n' > .env
docker pull willfarrell/autoheal:latest
echo "AUTOHEAL_IMAGE=$(docker image inspect --format '{{index .RepoDigests 0}}' willfarrell/autoheal:latest)" >> .env
chmod 600 .env
cat > pumba.sh << 'EOF'
#!/usr/bin/env bash
# Pumba 1.6.0 as a throw-away container. The label stops Pumba from picking itself.
exec docker run --rm --label com.gaiaadm.pumba=true \
  -v /var/run/docker.sock:/var/run/docker.sock \
  ghcr.io/alexei-led/pumba:1.6.0 "$@"
EOF
chmod 700 pumba.sh

Windows (PowerShell)#

Codepowershell
$base = "$HOME\docker_volumes\pumba"
foreach ($d in "data","config","logs","backups") { New-Item -ItemType Directory -Force "$base\$d" | Out-Null }
Set-Location $base
Set-Content -Encoding ascii .env 'DB_PASSWORD=change-me'
docker pull willfarrell/autoheal:latest
Add-Content -Encoding ascii .env "AUTOHEAL_IMAGE=$(docker image inspect --format '{{index .RepoDigests 0}}' willfarrell/autoheal:latest)"
@'
docker run --rm --label com.gaiaadm.pumba=true -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/alexei-led/pumba:1.6.0 @args
'@ | Set-Content -Encoding ascii pumba.ps1

Mac (Terminal)#

Same commands as Linux.

Check it worked. cat .env (Windows: Get-Content .env) shows two lines: DB_PASSWORD=change-me and AUTOHEAL_IMAGE=willfarrell/autoheal@sha256: followed by 64 hex characters (we did not run it, so we show no real value). If nothing follows the @, the pull failed: run it again.

Why the wrapper: the README's example is docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/alexei-led/pumba .... We pin the tag and add the label com.gaiaadm.pumba=true, which the source treats as "this is Pumba itself, never select it". On Windows and Mac the deployment page says to use --host because there is no Unix socket to mount; we did not test the -v form on Docker Desktop.

Tip: The wrapper leaves out the README's -it, so it also works in scripts.

Step 2: Write the lab and start it#

Three services. db is PostgreSQL with the skip label. app is the "application": a loop that runs select 1 every second, prints how long it took, and prints FAIL if the connect needs more than 5 seconds. It keeps a file /tmp/healthy for its healthcheck. autoheal restarts labelled containers that turn unhealthy. Compose needs $ written as $$, hence the odd script.

Linux#

Run in terminalbash
cd ~/docker_volumes/pumba
cat > compose.yaml << 'EOF'
services:
  db:
    image: postgres:17.12
    container_name: lab-db
    restart: unless-stopped
    environment:
      POSTGRES_USER: app
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: appdb
    volumes:
      - ./data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U app -d appdb"]
      interval: 5s
      timeout: 3s
      retries: 5
    labels:
      com.gaiaadm.pumba.skip: "true"

  app:
    image: postgres:17.12
    container_name: lab-app
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
    environment:
      PGHOST: lab-db
      PGUSER: app
      PGDATABASE: appdb
      PGPASSWORD: ${DB_PASSWORD}
      PGCONNECT_TIMEOUT: "5"
    entrypoint: ["bash", "-c"]
    command:
      - |
        trap 'exit 1' TERM
        touch /tmp/healthy
        while true; do
          start=$$(date +%s%3N)
          if psql -tAc 'select 1' > /dev/null 2>&1; then
            echo "$$(date -u +%T) ok $$(( $$(date +%s%3N) - start )) ms"
          else
            echo "$$(date -u +%T) FAIL"
          fi
          sleep 1 & wait $$!
        done
    healthcheck:
      test: ["CMD", "test", "-f", "/tmp/healthy"]
      interval: 5s
      timeout: 3s
      retries: 2
      start_period: 5s
    labels:
      lab.chaos: "app"
      autoheal: "true"

  autoheal:
    image: ${AUTOHEAL_IMAGE}
    container_name: lab-autoheal
    restart: unless-stopped
    network_mode: none
    environment:
      AUTOHEAL_CONTAINER_LABEL: autoheal
      AUTOHEAL_INTERVAL: "10"
      AUTOHEAL_START_PERIOD: "30"
      AUTOHEAL_DEFAULT_STOP_TIMEOUT: "10"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
EOF
docker compose up -d
docker compose ps

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\pumba"
@'
services:
  db:
    image: postgres:17.12
    container_name: lab-db
    restart: unless-stopped
    environment:
      POSTGRES_USER: app
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: appdb
    volumes:
      - ./data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U app -d appdb"]
      interval: 5s
      timeout: 3s
      retries: 5
    labels:
      com.gaiaadm.pumba.skip: "true"

  app:
    image: postgres:17.12
    container_name: lab-app
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
    environment:
      PGHOST: lab-db
      PGUSER: app
      PGDATABASE: appdb
      PGPASSWORD: ${DB_PASSWORD}
      PGCONNECT_TIMEOUT: "5"
    entrypoint: ["bash", "-c"]
    command:
      - |
        trap 'exit 1' TERM
        touch /tmp/healthy
        while true; do
          start=$$(date +%s%3N)
          if psql -tAc 'select 1' > /dev/null 2>&1; then
            echo "$$(date -u +%T) ok $$(( $$(date +%s%3N) - start )) ms"
          else
            echo "$$(date -u +%T) FAIL"
          fi
          sleep 1 & wait $$!
        done
    healthcheck:
      test: ["CMD", "test", "-f", "/tmp/healthy"]
      interval: 5s
      timeout: 3s
      retries: 2
      start_period: 5s
    labels:
      lab.chaos: "app"
      autoheal: "true"

  autoheal:
    image: ${AUTOHEAL_IMAGE}
    container_name: lab-autoheal
    restart: unless-stopped
    network_mode: none
    environment:
      AUTOHEAL_CONTAINER_LABEL: autoheal
      AUTOHEAL_INTERVAL: "10"
      AUTOHEAL_START_PERIOD: "30"
      AUTOHEAL_DEFAULT_STOP_TIMEOUT: "10"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
'@ | Set-Content -Encoding ascii compose.yaml
docker compose up -d
docker compose ps

Mac (Terminal)#

Same commands as Linux.

LineWhy
com.gaiaadm.pumba.skip: "true" on dbPumba never selects this container, even by name. The value must be the string true (user guide)
lab.chaos: "app" on appOur own label; we select the target with it (Step 3)
trap 'exit 1' TERMThe script ends on SIGTERM. Without it, process 1 in a container ignores that signal
PGCONNECT_TIMEOUT: "5"A connect over 5 seconds counts as FAIL
autoheal: "true"The label autoheal looks for. The quotes matter (autoheal guide)
network_mode: noneAutoheal only needs the local socket

If lab-db will not start on a Windows shared folder, drop the ./data line: the data is throwaway. Untested.

Check it worked. After about 30 seconds docker compose ps shows lab-db and lab-app healthy and lab-autoheal running. docker logs --tail 5 lab-app prints lines like <time> ok <n> ms. Write down a normal <n>: your baseline.

Tip: Run docker compose config -q first: it prints nothing when the file is valid, and names the line when a $ was not doubled.

Step 3: Preview with --dry-run, always first#

--dry-run shows what Pumba would do without doing it; target selection and --max-targets act as in a real run. We select with the label and the name: in the source at 1.6.0 the label goes to Docker as a filter and the name check runs on the result, so both must match. The docs promise AND only between several labels, so the dry-run is how you confirm it.

Linux#

Run in terminalbash
cd ~/docker_volumes/pumba
docker pull ghcr.io/alexei-led/pumba:1.6.0
docker pull ghcr.io/alexei-led/pumba-alpine-nettools:sha-2d64fca
./pumba.sh --version
./pumba.sh --dry-run --log-level info --label lab.chaos=app --max-targets 1 kill lab-app
./pumba.sh --dry-run --log-level info kill lab-db
./pumba.sh --dry-run --label lab.chaos=app --max-targets 1 netem \
  --tc-image ghcr.io/alexei-led/pumba-alpine-nettools:sha-2d64fca \
  --target lab-db --duration 60s delay --time 300 lab-app

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\pumba"
docker pull ghcr.io/alexei-led/pumba:1.6.0
docker pull ghcr.io/alexei-led/pumba-alpine-nettools:sha-2d64fca
.\pumba.ps1 --version
.\pumba.ps1 --dry-run --log-level info --label lab.chaos=app --max-targets 1 kill lab-app
.\pumba.ps1 --dry-run --log-level info kill lab-db
.\pumba.ps1 --dry-run --label lab.chaos=app --max-targets 1 netem `
  --tc-image ghcr.io/alexei-led/pumba-alpine-nettools:sha-2d64fca `
  --target lab-db --duration 60s delay --time 300 lab-app

Mac (Terminal)#

Same commands as Linux.

What to expect (from the docs and source, not from a run):

  • --version prints a version with 1.6.0.
  • The first dry-run logs killing container with dryrun=true and the name /lab-app (needs log level info; the default is warning).
  • The second finds nothing, because lab-db has the skip label.
  • The third prints the commands Pumba would run to apply and to revert the delay, and names the helper image. It pulls nothing and does not wait 60 seconds.

A plan is not a preflight check: it "cannot prove that tools, images, interfaces, privileges or a clean qdisc exist" (docs). The helper image has no numbered tags, so we pin sha-2d64fca, the same digest as latest on 5 December 2026.

Check it worked. The first dry-run names lab-app and nothing else. If not, fix the labels before going on.

Tip: Always add --max-targets 1 while you learn. Pumba then refuses to run at all when a typo would select two or more containers.

Step 4: Experiment 1, a killed container and the restart policy#

We expected restart: unless-stopped to bring a killed container back. Docker's docs say a manual stop switches the policy off, and a kill did not sound like a stop. Then we read the Docker source.

In daemon/kill.go (Moby, the engine behind Docker) the code for a kill request calls container.ExitOnNext() and sets HasBeenManuallyStopped = true. The source describes ExitOnNext as "signals to the monitor that it should not restart the container after we send the kill signal". The same lines are in release docker-v29.10.1 (24 November 2026). Pumba's kill and stop both use that kill call (pkg/runtime/docker/lifecycle.go at 1.6.0). So we expect the policy to not bring back a container that Pumba killed. We did not run it: check your own Docker.

Linux#

Run in terminalbash
cd ~/docker_volumes/pumba
sleep 15
./pumba.sh --label lab.chaos=app --max-targets 1 kill lab-app
sleep 15
docker ps -a --filter name=lab-app --format 'table {{.Names}}\t{{.Status}}'

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\pumba"
Start-Sleep 15
.\pumba.ps1 --label lab.chaos=app --max-targets 1 kill lab-app
Start-Sleep 15
docker ps -a --filter name=lab-app --format 'table {{.Names}}\t{{.Status}}'

Mac (Terminal)#

Same commands as Linux.

Check it worked. Our expectation: lab-app shows Exited (137) and stays down (137 is 128 plus signal 9). Autoheal does not help: it only restarts running, unhealthy containers (our reading of its script). If yours came back by itself, trust your result over our reading.

Tip: Run docker start lab-app and wait a minute before Step 5.

Step 5: Experiment 1b, a real crash and the restart policy#

Now a crash, the kind a restart policy is made for: the process exits by itself. We make it exit with exec, so Docker sees a normal exit. We give the program and its arguments separately: in the source at 1.6.0 the command text is not split on spaces, so the default kill 1 of pumba exec (the project's test runs it only with --dry-run) may not work. Wait 10 seconds after the container starts: a restart policy only takes effect after that (Docker docs).

Linux#

Run in terminalbash
cd ~/docker_volumes/pumba
sleep 15
./pumba.sh --label lab.chaos=app --max-targets 1 exec --command sh --args "-c" --args "kill -TERM 1" lab-app
sleep 10
docker ps --filter name=lab-app --format 'table {{.Names}}\t{{.Status}}'
docker inspect --format 'restarts={{.RestartCount}}' lab-app

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\pumba"
Start-Sleep 15
.\pumba.ps1 --label lab.chaos=app --max-targets 1 exec --command sh --args "-c" --args "kill -TERM 1" lab-app
Start-Sleep 10
docker ps --filter name=lab-app --format 'table {{.Names}}\t{{.Status}}'
docker inspect --format 'restarts={{.RestartCount}}' lab-app

Mac (Terminal)#

Same commands as Linux.

Check it worked. We expect restarts=1 or more and a status such as Up 5 seconds: the script exited with code 1 after the trap, and the policy started it again. A policy brings back crashes, not kills: testing "does my service come back" with pumba kill tests the wrong thing.

Tip: Before trusting any "it restarts" claim, check docker inspect --format '{{.RestartCount}}' <name>. It counts restarts by the policy only. Autoheal's restarts do not raise it.

Step 6: Experiment 2, autoheal and an unhealthy container#

Now the case a restart policy cannot see: the process runs but the app is broken. We delete the file that the healthcheck needs, using Pumba's exec. Docker marks lab-app unhealthy after two failed checks and autoheal restarts it; the script recreates the file on start.

Linux#

Run in terminalbash
cd ~/docker_volumes/pumba
./pumba.sh --dry-run --label lab.chaos=app --max-targets 1 exec --command rm --args /tmp/healthy lab-app
./pumba.sh --label lab.chaos=app --max-targets 1 exec --command rm --args /tmp/healthy lab-app
docker inspect --format '{{.State.Health.Status}}' lab-app
docker logs --tail 5 lab-autoheal

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\pumba"
.\pumba.ps1 --dry-run --label lab.chaos=app --max-targets 1 exec --command rm --args /tmp/healthy lab-app
.\pumba.ps1 --label lab.chaos=app --max-targets 1 exec --command rm --args /tmp/healthy lab-app
docker inspect --format '{{.State.Health.Status}}' lab-app
docker logs --tail 5 lab-autoheal

Mac (Terminal)#

Same commands as Linux.

Check it worked. Our estimate from the autoheal guide: unhealthy after 10 to 15 seconds, restarted in the next 10-second pass. The autoheal log then has a line like Container /lab-app (<id>) found to be unhealthy - Restarting container now with ..., and docker ps --filter name=lab-app shows health: starting, then healthy. If it stays unhealthy, check the labels: docker inspect --format '{{json .Config.Labels}}' lab-app must show "autoheal":"true".

Step 7: Experiment 3, 300 ms between the app and its database#

Open a second terminal and follow the log: docker logs -f --tail 5 lab-app. Then run the delay for 60 seconds. --target lab-db limits it to packets going to the database. It delays packets that leave lab-app, so every query pays about 300 ms and a new connection needs several round trips.

Linux#

Run in terminalbash
cd ~/docker_volumes/pumba
./pumba.sh --label lab.chaos=app --max-targets 1 netem \
  --tc-image ghcr.io/alexei-led/pumba-alpine-nettools:sha-2d64fca \
  --target lab-db --duration 60s delay --time 300 lab-app

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\pumba"
.\pumba.ps1 --label lab.chaos=app --max-targets 1 netem `
  --tc-image ghcr.io/alexei-led/pumba-alpine-nettools:sha-2d64fca `
  --target lab-db --duration 60s delay --time 300 lab-app

Mac (Terminal)#

Same commands as Linux.

--time is in milliseconds. The command waits for the 60 seconds, removes the delay and exits. Do not stop or kill lab-app while it runs (Common mistakes).

Check it worked. Our expectation: the ok lines show a clearly larger <n> than your baseline (probably over a second, since each check opens a new connection) and fall back after 60 seconds. The app survives if no FAIL appears. We measured nothing: do not quote our guess.

Now find the breaking point: repeat with --time 1000, then 3000. The script gives up after 5 seconds, so at some delay you see FAIL. That number is the result: the delay at which an app with those timeouts stops working.

Tip: Watch the app's own log, not Pumba's output: Pumba only reports that the delay was applied and removed.

Step 8: Check for leftovers and clean up#

A run that dies half-way (closed terminal, kill -9) can leave a delay rule or helper behind. pumba status lists what Pumba left.

Linux#

Run in terminalbash
cd ~/docker_volumes/pumba
./pumba.sh status --check lab-app
echo "exit code: $?"
docker ps -a --filter label=com.gaiaadm.pumba.skip=true --format 'table {{.Names}}\t{{.Status}}'
docker compose down

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\pumba"
.\pumba.ps1 status --check lab-app
"exit code: $LASTEXITCODE"
docker ps -a --filter label=com.gaiaadm.pumba.skip=true --format 'table {{.Names}}\t{{.Status}}'
docker compose down

Mac (Terminal)#

Same commands as Linux.

Check it worked. status --check prints a verdict and exits 0 only when the container is clean (user guide); dirty or unknown exits 1. The docker ps filter should list only lab-db: a left-over helper carries the skip label too. docker compose down removes the lab; delete ~/docker_volumes/pumba/data afterwards.

For cleanup by hand after a crash, read the leftovers section: delete the listed qdisc with nsenter and remove helpers by their com.gaiaadm.pumba.run-id label. Release 1.6.0 added pumba revert --run-id <id>; it does not remove qdiscs.

Put it behind HTTPS with Traefik? You do not need to#

Pumba serves no web page and opens no port, so there is nothing to put behind HTTPS, at home or on a server with a domain.

With Traefik#

No labels or routes are needed. Our Traefik guide is for apps with a page.

Without Traefik: Caddy#

No reverse_proxy line is needed; see our Caddy guide for apps with a page. If you drive a remote Docker with --host tcp://..., use the TLS flags from the user guide (--tls, --tlsverify). Never expose the Docker API on plain TCP.

Security and testing#

ControlHow
Docker socketRoot-level power over the host. Pumba can kill, exec into, remove and create containers; whoever can run it controls every container there. :ro on the socket does not limit the API
Socket proxyPumba needs write calls (kill, exec, create). A proxy that allows them gives close to the same power. The docs have no recipe, so we give none; see our socket proxy guide
WhereA lab VM or spare box, never a host with data you cannot rebuild
TargetsLabel the target, protect the rest with com.gaiaadm.pumba.skip=true, add --max-targets 1
pumba rmForce-removes by default and also removes volumes (user guide). Use --force=false --volumes=false or avoid it
Secrets.env with chmod 600; the lab password is a dummy
Reports--webhook and --slackhook send container names and IDs off the host. Use HTTPS

Quick tests when something looks wrong:

Run in terminalbash
cd ~/docker_volumes/pumba
docker compose ps
docker compose config -q
./pumba.sh status
docker logs --tail 20 lab-app

Common mistakes#

MistakeWhy it happensDo this instead
command 'tc' not found inside the /tryme (e61e81d4...) container (issue 121)The check ran in the target, which lacked tc (and which, which the check uses)Always give --tc-image. A custom image needs sh, grep, tc, which and tail
failed to stop netem: failed to start tc-container: Error response from daemon: No such container: 28b884fc... (issue 175)The target died while its delay ran, so the cleanup found nothingOne experiment at a time; never kill the target during netem. The issue is closed (February 2026); we did not test 1.6.0
Expecting restart: unless-stopped to bring back a pumba kill containerDocker counts a kill through its API as a manual stop (Step 4)Test with exec so the process exits; read RestartCount
flag provided but not defined: -cpu 1 --vm 1 ... (issue 174)A value starting with dashes was read as a Pumba flag; the maintainer said to use =Write --stressors="--cpu 1 --timeout 60s". In exec, one --args per argument
"Multiple labels do not work" (issue 171)Unclear meaning in 2020. The docs now say ANDOne label is enough. Several: all must match (--label a=1 --label b=2)
kill, stop or rm with only --label and no nameThe docs show pumba --label app=web kill, but the kill source requires a name: container name, list of names, or RE2 regex is requiredGive the name too, as we do
failed to check if command exists in a container: Error response from daemon: must provide at least one stream to attach to: invalid argument (issue 238)Rootless Podman. Closed April 2026 (Podman support came in 1.1.0)Network chaos needs rootful Podman; it now fails fast with a clear message. See our Podman guide
A --duration that is not shorter than --intervalThe duration must be shorter than the interval (network guide)Use --interval only for repeated chaos
Running without --dry-run, or with a regex that is too wide (re2:.*)A wide regex matches everything you loveDry-run first, --max-targets 1, skip labels
AI assistants: docker run gaiaadm/pumba ... netem delay --time 3s, latest tags, --interval after the subcommandThe Docker Hub image is deprecated, flags are misplaced, --time is in millisecondsUse ghcr.io/alexei-led/pumba:1.6.0; global flags first: pumba --interval 30s netem --duration 10s delay --time 300 <name>
AI assistants: "add --cap-add NET_ADMIN to the Pumba container" or "install Pumba on Windows"Mixed up with other toolsPumba starts a helper that has NET_ADMIN itself. There is no Windows binary

Tip: --time is in milliseconds. --time 300 is 300 ms and --time 3000 is three seconds. A missing zero is the usual reason a test "does nothing".

Tip: After every network test run ./pumba.sh status --check lab-app. A clean verdict means nothing slow is left on the container.

Tip: Keep a short log: command, what you expected, what happened. A chaos test is worth it only if you can repeat it after a fix.

Troubleshooting#

ProblemSolution
Pumba cannot reach DockerCheck the socket mount and docker ps. On Docker Desktop read the deployment page about --host
Nothing was selectedDry-run with --log-level info; docker inspect --format '{{json .Config.Labels}}' lab-app
Delay not visible--time is in milliseconds; check --interface (default eth0) and that traffic goes to --target
Helper image cannot be pulledPull it by hand; Pumba pulls by default (--pull-image is true), so an offline lab needs it present
Lab container does not startdocker compose logs --tail=100 db and docker compose config -q
Helper still there./pumba.sh status, then Step 8
Pumba exits 1An error or a failed cleanup: read its stderr

Exact error texts#

  • iptables comment match (xt_comment) unavailable: run sudo modprobe xt_comment on the host (network chaos guide). It concerns the iptables command.
  • container name, list of names, or RE2 regex is required: kill needs a name or pattern (source at 1.6.0).
  • On minikube netem fails because the kernel module sch_netem is missing (network chaos guide). For Docker Desktop's VM we found no statement.
  • Got permission denied while trying to connect to the Docker daemon socket ... (issue 83, 2018): Docker's own message, usually a user outside the docker group.

Known bugs#

No open bug about the commands used here (December 2026). Open: a scenario proposal (issue 362) and a tooling item (issue 413). The docs disagree about the default: the user guide says tc runs inside the target, the flag table says the default --tc-image is the nettools image. So we always pass --tc-image.

Updates and backups#

Update Pumba. Read the release notes first. Change the tag in pumba.sh (Windows: pumba.ps1), pull the image, run a dry-run and --version. The helper image has no numbered tags: pin the sha- tag that matches latest.

What to back up. Only compose.yaml, .env and your test notes; the database is throwaway. Back up your real apps before you test them, for example with our docker-volume-backup guide.

Linux and Mac#

Save as ~/docker_volumes/pumba/backup.sh:

File contentbash
#!/usr/bin/env bash
set -euo pipefail
base="$HOME/docker_volumes/pumba"
out="$base/backups/pumba-$(date +%F).tar.gz"
tar -czf "$out" -C "$base" .env compose.yaml pumba.sh
chmod 600 "$out"

Run chmod 700 on it. Cron is optional here: a lab needs a backup only if you changed the files.

Windows (PowerShell)#

Codepowershell
$base = "$HOME\docker_volumes\pumba"
$out = "$base\backups\pumba-$(Get-Date -Format yyyy-MM-dd).tar.gz"
tar.exe -czf $out -C $base .env compose.yaml pumba.ps1

Restore test#

Unpack the archive in an empty folder and run docker compose config -q. It prints nothing when the restored files are valid.

Performance and resources#

The docs give no minimum RAM or CPU and we measured none. The image is a scratch image with one binary (deployment page); the project's Kubernetes example asks for 10m CPU and 5 MB, with limits of 100m and 20 MB. The helper lives only as long as --duration. Watch the lab with docker stats, our Beszel guide or Dozzle for logs.

FAQ#

Does Pumba work on Windows or Mac? No Windows binary exists and none is planned. The Mac binary only drives a Docker that runs elsewhere; the README names Colima as an example (see our Colima guide). The container image on Docker Desktop is not documented and we did not test it.

Is this safe at home? When you keep the three guards: dry-run first, one labelled target with --max-targets 1, a skip label on everything else. Never on the only copy of your data.

Why exec and not kill? A kill through Docker's API counts as a manual stop and switches the restart policy off (Step 4). exec lets the process exit, like a crash.

Can it run on Kubernetes? Yes, the deployment page has DaemonSet examples, and it supports containerd and Podman. We only use Docker. Our Kubernetes introduction explains the basics.

What else can it do? stress (CPU, memory, I/O) and iptables loss (incoming packets). We did not use them here.

Sources#

Checked against the official docs on 2026-12-05. Nothing was run on a real machine by DIY Lab Hub; the commands come from the docs, the source and the issues above.

Try one of these