Skip to content

Commit

Permalink
Only pre-pull the container images on non-leader instance if not present
Browse files Browse the repository at this point in the history
Avoids triggering docker.io rate-limiting.
  • Loading branch information
cvaroqui committed Dec 23, 2020
1 parent bb0fdd7 commit d2ba530
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion opensvc/drivers/resource/container/docker/__init__.py
Expand Up @@ -895,8 +895,18 @@ def unprovision(self):
self.container_rm()

def provisioner_shared_non_leader(self):
if not self.lib.docker_daemon_private:
if self.lib.docker_daemon_private:
return
try:
image_id = self.lib.get_image_id(self.image)
return
except ValueError as exc:
pass
try:
self.image_pull()
return
except ex.Error as exc1:
self.log.warning("could not pull image '%s': %s", self.image, str(exc1).strip())

def start(self):
if self.image_pull_policy == "always":
Expand Down

0 comments on commit d2ba530

Please sign in to comment.