From ba9807a0a96115dbed66d10249bc25e7a125599c Mon Sep 17 00:00:00 2001 From: Christophe Varoqui Date: Tue, 20 Feb 2018 15:25:06 +0100 Subject: [PATCH] Use the system's docker daemon if no data dir is set nor docker_daemon_private So no configuration in the DEFAULT section is needed for the simplest case. --- lib/rcDocker.py | 17 ++++++++++------- lib/svcdict.py | 2 +- usr/share/doc/template.service.DEFAULT.conf | 11 +++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/rcDocker.py b/lib/rcDocker.py index da5bfd1d3e..53d6475f2e 100644 --- a/lib/rcDocker.py +++ b/lib/rcDocker.py @@ -27,11 +27,20 @@ def __init__(self, svc=None): self.max_wait_for_dockerd = 5 self.docker_info_done = False + try: + self.docker_data_dir = \ + self.svc.conf_get('DEFAULT', 'docker_data_dir') + except ex.OptNotFound as exc: + self.docker_data_dir = exc.default + try: self.docker_daemon_private = \ self.svc.conf_get('DEFAULT', 'docker_daemon_private') except ex.OptNotFound: - self.docker_daemon_private = True + if self.docker_data_dir: + self.docker_daemon_private = True + else: + self.docker_daemon_private = False if rcEnv.sysname != "Linux": self.docker_daemon_private = False @@ -47,12 +56,6 @@ def __init__(self, svc=None): except ex.OptNotFound as exc: self.dockerd_exe_init = exc.default - try: - self.docker_data_dir = \ - self.svc.conf_get('DEFAULT', 'docker_data_dir') - except ex.OptNotFound as exc: - self.docker_data_dir = exc.default - try: self.docker_daemon_args = \ self.svc.conf_get('DEFAULT', 'docker_daemon_args') diff --git a/lib/svcdict.py b/lib/svcdict.py index f890adf8de..83dd6fe59d 100644 --- a/lib/svcdict.py +++ b/lib/svcdict.py @@ -245,7 +245,7 @@ def __init__(self): keyword="docker_data_dir", at=True, order=12, - text="If the service has docker-type container resources and docker_daemon_private is set to True, the service handles the startup of a private docker daemon. Its socket is /services//docker.sock, and its data directory must be specified using this parameter. This organization is necessary to enable service relocalization.", + text="If the service has docker-type container resources and this keyword is set, the service starts a service-private docker daemon. Its socket is /services//docker.sock, and its data directory is specified by this keyword. This organization is necessary to enable stateful service relocalization.", example="/srv/svc1/data/docker" ) diff --git a/usr/share/doc/template.service.DEFAULT.conf b/usr/share/doc/template.service.DEFAULT.conf index e57e27370a..fc6a91e7c8 100644 --- a/usr/share/doc/template.service.DEFAULT.conf +++ b/usr/share/doc/template.service.DEFAULT.conf @@ -249,12 +249,11 @@ # inheritance: leaf > head # scope order: specific > generic # -# desc: If the service has docker-type container resources and -# docker_daemon_private is set to True, the service handles the -# startup of a private docker daemon. Its socket is -# /services//docker.sock, and its data directory -# must be specified using this parameter. This organization is -# necessary to enable service relocalization. +# desc: If the service has docker-type container resources and this keyword +# is set, the service starts a service-private docker daemon. Its +# socket is /services//docker.sock, and its data +# directory is specified by this keyword. This organization is +# necessary to enable stateful service relocalization. # ;docker_data_dir = /srv/svc1/data/docker