diff --git a/everware/spawner.py b/everware/spawner.py
index 200ce74..d6b562c 100755
--- a/everware/spawner.py
+++ b/everware/spawner.py
@@ -7,7 +7,7 @@
from concurrent.futures import ThreadPoolExecutor
import docker
-from docker.errors import APIError
+from docker.errors import APIError, DockerException
from smtplib import SMTPException
from jupyterhub.utils import wait_for_http_server
@@ -44,26 +44,30 @@ def __init__(self, **kwargs):
self._cur_waiter = None
self._is_empty = False
# User may have custom client (e.g. when BYOR is used)
- self._custom_client = None
+ self._byor_client = None
ContainerHandler.__init__(self, **kwargs)
EmailNotificator.__init__(self)
@property
def client(self):
- if self._custom_client is not None:
- return self._custom_client
+ if self._byor_client is not None:
+ return self._byor_client
return super(CustomDockerSpawner, self).client
+ byor_timeout = Int(20, min=1, config=True, help='Timeout for connection to BYOR Docker daemon')
@gen.coroutine
def _set_client(self):
"""Prepare a client for the user."""
- if self._byor_is_used:
+ if self.byor_is_used:
byor_docker_url = self.user_options['byor_docker_url']
+ # version='auto' causes a connection to the daemon
+ self._byor_client = docker.Client(byor_docker_url,
+ version='auto',
+ timeout=self.byor_timeout)
self.container_ip = byor_docker_url.split(':')[0]
- self._custom_client = docker.Client(base_url=byor_docker_url, tls=None, version='auto')
else:
- self.container_ip = self.__class__.container_ip
- self._custom_client = None
+ self.container_ip == self.__class__.container_ip
+ self._byor_client = None
# We override the executor here to increase the number of threads
@property
@@ -131,7 +135,8 @@ def load_state(self, state):
def _options_form_default(self):
return """
-
+
+
Git repository
-
- (optionally) If you want to launch a container on your own machine, enter ip and port of the docker-host
- running on it (e.g. 11.22.33.44:2375)
-
-
-
-
-
+
+
+
+
+
+
+
+ For a successful run Docker
+ must be installed on your server.
+ Enter ip and port of the Docker daemon running on your server.
+ (Click
+ here to learn how to run Docker daemon on a particular port)
+