I am trying to run this command with the docker python sdk but I am not sure I am passing the commands in properly. How would I run the command "stress --cpu 4 &" using the docker python sdk?
m = container.exec_run("stress --cpu 4 &")
I am trying to run this command with the docker python sdk but I am not sure I am passing the commands in properly. How would I run the command "stress --cpu 4 &" using the docker python sdk?
m = container.exec_run("stress --cpu 4 &")
You can just put it in one string
m = container.exec_run("stress --cpu 4")
there are some examples here
if you want to run a command in background, don't use &
, use detach=True
m = container.exec_run("stress --cpu 4", detach=True)