Hello,
I want to run a container and give it a maximum of N seconds to run after which I’d like the container terminated.
Here is what I’m doing:
1. docker run ... & # run it in the bg, get pid into $pid, etc.
2. get the container id in bash: cid=`docker ps -aq | awk '{print $1}'`,
3. nohup something like (sleep N && docker kill $cid) & wait $pid
However, I’m convinced there must be a better way. Can you please help with a suggestion or recommendation.
Thanks much,
&