summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiacomo Leidi <goodoldpaul@autistici.org>2024-06-11 22:04:58 +0200
committerGuix Patches Tester <>2024-06-11 23:17:10 +0200
commite180739ba99ebecf6d93c915fc4b5af1bcaf88ef (patch)
treeb3ed0566ae9332b38865ea999aa3d0259ccfc9ba
parentb076d80c38ee4065da407b8e9bc2ff402441be58 (diff)
downloadguix-patches-e180739ba99ebecf6d93c915fc4b5af1bcaf88ef.tar
guix-patches-e180739ba99ebecf6d93c915fc4b5af1bcaf88ef.tar.gz
gnu: docker: Allow setting Shepherd auto-start? in oci-container-configuration.
* gnu/services/docker.scm (oci-container-configuration) [auto-start?]: New field; (oci-container-shepherd-service): use it. * doc/guix.texi: Document it. Change-Id: Id093d93effbbec3e1be757f8be83cf5f62eaeda7
-rw-r--r--doc/guix.texi4
-rw-r--r--gnu/services/docker.scm8
2 files changed, 12 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 40296fcd5f..cc3847eadb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -40703,6 +40703,10 @@ When @code{log-file} is set, it names the file to which the service's
standard output and standard error are redirected. @code{log-file} is created
if it does not exist, otherwise it is appended to.
+@item @code{auto-start?} (default: @code{#t}) (type: boolean)
+Whether this service should be started automatically by the Shepherd. If it
+is @code{#f} the service has to be started manually with @command{herd start}.
+
@item @code{network} (default: @code{""}) (type: string)
Set a Docker network for the spawned container.
diff --git a/gnu/services/docker.scm b/gnu/services/docker.scm
index 678e8b1139..712ca14cba 100644
--- a/gnu/services/docker.scm
+++ b/gnu/services/docker.scm
@@ -75,6 +75,7 @@
oci-container-configuration-provision
oci-container-configuration-requirement
oci-container-configuration-log-file
+ oci-container-configuration-auto-start?
oci-container-configuration-network
oci-container-configuration-ports
oci-container-configuration-volumes
@@ -467,6 +468,10 @@ service.")
"When @code{log-file} is set, it names the file to which the service’s
standard output and standard error are redirected. @code{log-file} is created
if it does not exist, otherwise it is appended to.")
+ (auto-start?
+ (boolean #t)
+ "Whether this service should be started automatically by the Shepherd. If it
+is @code{#f} the service has to be started manually with @command{herd start}.")
(network
(maybe-string)
"Set a Docker network for the spawned container.")
@@ -670,6 +675,8 @@ operating-system, gexp or file-like records but ~a was found")
(oci-image-repository image))))))
(let* ((docker (file-append docker-cli "/bin/docker"))
+ (auto-start?
+ (oci-container-configuration-auto-start? config))
(user (oci-container-configuration-user config))
(group (oci-container-configuration-group config))
(host-environment
@@ -691,6 +698,7 @@ operating-system, gexp or file-like records but ~a was found")
(shepherd-service (provision `(,(string->symbol name)))
(requirement `(dockerd user-processes ,@requirement))
(respawn? #f)
+ (auto-start? auto-start?)
(documentation
(string-append
"Docker backed Shepherd service for "