From 933a303ede8b032ef56dee3c68f35b67b1ec4f98 Mon Sep 17 00:00:00 2001 From: Antoine Verlant Date: Mon, 8 May 2017 10:09:36 +0200 Subject: [PATCH] Fix the way the list of mounts is made for service. Signed-off-by: Antoine Verlant --- docker/types/services.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/types/services.py b/docker/types/services.py index 9291c9bd42..a95e3e5478 100644 --- a/docker/types/services.py +++ b/docker/types/services.py @@ -107,11 +107,14 @@ def __init__(self, image, command=None, args=None, hostname=None, env=None, if labels is not None: self['Labels'] = labels if mounts is not None: + parsed_mounts = [] for mount in mounts: if isinstance(mount, six.string_types): - mounts.append(Mount.parse_mount_string(mount)) - mounts.remove(mount) - self['Mounts'] = mounts + parsed_mounts.append(Mount.parse_mount_string(mount)) + else: + # If mount already parsed + parsed_mounts.append(mount) + self['Mounts'] = parsed_mounts if stop_grace_period is not None: self['StopGracePeriod'] = stop_grace_period