handled exception if the docker deamon does not expose events on the REST-API
This commit is contained in:
parent
312e91a940
commit
f7713d84a3
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python3.4
|
||||
|
||||
import os
|
||||
import sys
|
||||
import http.client
|
||||
import json
|
||||
import signal
|
||||
|
@ -118,7 +119,12 @@ if not os.path.exists(target_path):
|
|||
pid = get_pid()
|
||||
|
||||
conn = http.client.HTTPConnection("localhost:2375")
|
||||
try:
|
||||
conn.request("GET", "/events")
|
||||
except ConnectionRefusedError:
|
||||
print('Docker does not expose events on its REST-API. Perhaps it is not running?')
|
||||
sys.exit(-1)
|
||||
|
||||
response = conn.getresponse()
|
||||
|
||||
events = ""
|
||||
|
|
Loading…
Reference in New Issue