summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/api/container.py2
-rw-r--r--docker/models/containers.py2
-rw-r--r--docker/types/containers.py15
-rw-r--r--docker/types/healthcheck.py12
4 files changed, 26 insertions, 5 deletions
diff --git a/docker/api/container.py b/docker/api/container.py
index 97a39b6..5668b43 100644
--- a/docker/api/container.py
+++ b/docker/api/container.py
@@ -418,6 +418,8 @@ class ContainerApiMixin(object):
networking_config (dict): A networking configuration generated
by :py:meth:`create_networking_config`.
runtime (str): Runtime to use with this container.
+ healthcheck (dict): Specify a test to perform to check that the
+ container is healthy.
Returns:
A dictionary with an image 'Id' key and a 'Warnings' key.
diff --git a/docker/models/containers.py b/docker/models/containers.py
index 300c5a9..cf01b27 100644
--- a/docker/models/containers.py
+++ b/docker/models/containers.py
@@ -516,6 +516,8 @@ class ContainerCollection(Collection):
container, as a mapping of hostname to IP address.
group_add (:py:class:`list`): List of additional group names and/or
IDs that the container process will run as.
+ healthcheck (dict): Specify a test to perform to check that the
+ container is healthy.
hostname (str): Optional hostname for the container.
init (bool): Run an init inside the container that forwards
signals and reaps processes
diff --git a/docker/types/containers.py b/docker/types/containers.py
index 6bbb57a..030e292 100644
--- a/docker/types/containers.py
+++ b/docker/types/containers.py
@@ -565,10 +565,17 @@ class ContainerConfig(dict):
'stop_timeout was only introduced in API version 1.25'
)
- if healthcheck is not None and version_lt(version, '1.24'):
- raise errors.InvalidVersion(
- 'Health options were only introduced in API version 1.24'
- )
+ if healthcheck is not None:
+ if version_lt(version, '1.24'):
+ raise errors.InvalidVersion(
+ 'Health options were only introduced in API version 1.24'
+ )
+
+ if version_lt(version, '1.29') and 'StartPeriod' in healthcheck:
+ raise errors.InvalidVersion(
+ 'healthcheck start period was introduced in API '
+ 'version 1.29'
+ )
if isinstance(command, six.string_types):
command = split_command(command)
diff --git a/docker/types/healthcheck.py b/docker/types/healthcheck.py
index ba63d21..8ea9a35 100644
--- a/docker/types/healthcheck.py
+++ b/docker/types/healthcheck.py
@@ -12,12 +12,14 @@ class Healthcheck(DictType):
interval = kwargs.get('interval', kwargs.get('Interval'))
timeout = kwargs.get('timeout', kwargs.get('Timeout'))
retries = kwargs.get('retries', kwargs.get('Retries'))
+ start_period = kwargs.get('start_period', kwargs.get('StartPeriod'))
super(Healthcheck, self).__init__({
'Test': test,
'Interval': interval,
'Timeout': timeout,
- 'Retries': retries
+ 'Retries': retries,
+ 'StartPeriod': start_period
})
@property
@@ -51,3 +53,11 @@ class Healthcheck(DictType):
@retries.setter
def retries(self, value):
self['Retries'] = value
+
+ @property
+ def start_period(self):
+ return self['StartPeriod']
+
+ @start_period.setter
+ def start_period(self, value):
+ self['StartPeriod'] = value