GNU bug report logs - #71263
Add additional fields to oci-container-configuration

Previous Next

Package: guix-patches;

Reported by: paul <goodoldpaul <at> autistici.org>

Date: Wed, 29 May 2024 21:38:02 UTC

Severity: normal

Done: Zheng Junjie <zhengjunjie <at> iscas.ac.cn>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 71263 <at> debbugs.gnu.org (full text, mbox):

From: Giacomo Leidi <goodoldpaul <at> autistici.org>
To: 71263 <at> debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul <at> autistici.org>
Subject: [PATCH v2 3/5] gnu: docker: Allow setting Shepherd auto-start? in
 oci-container-configuration.
Date: Tue, 11 Jun 2024 22:04:58 +0200
* 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
---
 doc/guix.texi           | 4 ++++
 gnu/services/docker.scm | 8 ++++++++
 2 files changed, 12 insertions(+)

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 @@ Miscellaneous Services
 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 @@ (define-module (gnu services docker)
             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 @@ (define-configuration/no-serialization oci-container-configuration
    "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 @@ (define (oci-container-shepherd-service config)
                             (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 @@ (define (oci-container-shepherd-service config)
     (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 "
-- 
2.45.1





This bug report was last modified 319 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.