run stress test from inside the container by entering its namespaces
by vincix from LinuxQuestions.org on (#558YV)
Hi,
I'm trying to run a stress test from the host on a container by making use of namespace using nsenter, but it doesn't seem to work. I'm testing it using stress and docker stats.
So I'm entering several namespaces (I guess almost all, with the exception of user namespace, as I'm not using it with docker, and mount, as I'm trying to run the executable from the host):
Code:nsenter -n -C -i -p -t $(docker inspect --format '{{.State.Pid}}' filebeat) stress -c 2This stresses the cpu by deploying two workers.
I would have thought entering the pid namespace is enough and/or the cgroup one, but I've added the others just to make sure, as it were.
Unfortunately this doesn't work, the test is still run outside the container environment and docker stats continues to say that the container isn't using any cpu.
I'm trying to stress test a container like this, without having to install anything there, and it would offer me great flexibility if I could run other tools in a similar fashion.
Any ideas?


I'm trying to run a stress test from the host on a container by making use of namespace using nsenter, but it doesn't seem to work. I'm testing it using stress and docker stats.
So I'm entering several namespaces (I guess almost all, with the exception of user namespace, as I'm not using it with docker, and mount, as I'm trying to run the executable from the host):
Code:nsenter -n -C -i -p -t $(docker inspect --format '{{.State.Pid}}' filebeat) stress -c 2This stresses the cpu by deploying two workers.
I would have thought entering the pid namespace is enough and/or the cgroup one, but I've added the others just to make sure, as it were.
Unfortunately this doesn't work, the test is still run outside the container environment and docker stats continues to say that the container isn't using any cpu.
I'm trying to stress test a container like this, without having to install anything there, and it would offer me great flexibility if I could run other tools in a similar fashion.
Any ideas?