Skip to content

Commit

Permalink
docker: do not crash when docker daemon socket is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelnicolas committed Sep 22, 2020
1 parent f07a803 commit 2ead8d9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions dalidock
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,28 @@ class DockerClient:

class DockerEventsHandler:
def __init__(self, dns_entries, lb_entries, config_lock):
self.docker = DockerClient(DOCKER_SOCKET)
self.myid = self.getMyCid()
if not os.path.exists(DOCKER_SOCKET):
self.docker = None
self.myid = "dalidock"

else:
self.docker = DockerClient(DOCKER_SOCKET)
self.myid = self.getMyCid()

self.dns = dns_entries
self.lb = lb_entries
self.config_lock = config_lock
self.loop = True

def serve(self):
if self.docker is None:
log("Skipping docker events handler as %s not found" % (DOCKER_SOCKET))

while self.loop:
time.sleep(1)

return

log("Starting docker events handler")

# register current dalidock container (which will be used later by loadbalancer)
Expand Down

0 comments on commit 2ead8d9

Please sign in to comment.