0

I want to write a python script (Python 2.7) to check the health of the Docker (using command 'docker ps').

docker ps 

and it returns anything then it is healthy and exit the script. If the command is hung for more than 2 minutes then print "The Docker is stopped"

Kindly help me to figure out how to check whether it hung for 2 minutes.

Thanks in advance.

3
  • subprocess.check_output() takes an explicit timeout option (as of Python 3.3). Commented Aug 12, 2020 at 11:11
  • 1
    Sorry I am currently using python 2.7. is this work for python 2.7 Commented Aug 12, 2020 at 11:44
  • What have you tried so far? Where are you stuck? Commented Aug 25, 2020 at 10:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.