Stress testing for docker container I want my container to die under high pressure to check monitoring and alerting as well as compose autorestarts. What is best way to simulate heavy load within docker container. I've tried so far

root@docker-vm:/# stress --vm 10 --vm-bytes 2048M --vm-hang 20
stress: info: [238] dispatching hogs: 0 cpu, 0 io, 10 vm, 0 hdd
stress: FAIL: [238] (415) &lt;-- worker 243 got signal 9
stress: WARN: [238] (417) now reaping child worker processes
stress: FAIL: [238] (451) failed run completed in 101s



for memory pressure (hoping OOM kill for host machine which has 4Gb of ram) and stress --cpu 100 which is obviously not really harmful.

Is there some tool to achieve that for docker or preferred approach I should use?
Just a quick follow-up on pumba. Installation (for Ubuntu):

$ curl -SL https://github.com/alexei-led/pumba/releases/download/0.7.2/pumba_linux_amd64 -O
$ sudo mv pumba_linux_amd64 /usr/bin/pumba
$ sudo chmod +x /usr/bin/pumba
$ pumba --version


It uses stress-ng under the hood, so same commands apply. Examples: 


$ pumba stress -d 1m container_name


-d 1m - duration of a stress test (1 minute)

container_name - your target container (from docker ps output)
$ pumba stress -d 30s --stressors "--vm 10 --vm-bytes 512M --vm-hang 20" container_name


-d 30 - duration 30 seconds

-stressors - parameters passed to stress-ng app

In this particular example we create 10 workers spinning on malloc()/free() allocating 512MB each and sleep 20 seconds before freeing the memory.


Default stressor as in first example is --cpu 4 --timeout 60s