From bfa4e179e285d6521351a9d8eea6074630bbe62a Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Sat, 25 Oct 2025 22:35:51 +0200 Subject: services: Support list of strings for oci-container-configuration's entrypoint. Dockerfile's ENTRYPOINT statement supports also a list of strings. This patch implements this behavior for oci-container-configuration. * oci/services/containers.scm (string-or-list-of-strings?): New procedure. (oci-container-configuration)[entrypoint]: Change field type to maybe-string-or-list-of-strings. (oci-container-configuration->options): Use it. * doc/guix.texi: Document it. Change-Id: I1c94dec79c9f4b2324225810a7926be251bfd795 Reviewed-by: Owen T. Heisler Signed-off-by: Sharlatan Hellseher --- gnu/services/containers.scm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/containers.scm b/gnu/services/containers.scm index af947a6681a..a01df18ba5d 100644 --- a/gnu/services/containers.scm +++ b/gnu/services/containers.scm @@ -521,6 +521,15 @@ but ~a was found") el)))) reference (string-append "localhost/" reference))) +(define (string-or-list-of-strings? value) + (if (or (string? value) + ((list-of string) value)) + value + (raise + (formatted-message + (G_ "entrypoint may only be a single string or a list of strings +but ~a was found") value)))) + (define (oci-lowerable-image? image) (or (manifest? image) (operating-system? image) @@ -544,6 +553,7 @@ but ~a was found") el)))) value)) (define-maybe/no-serialization string) +(define-maybe/no-serialization string-or-list-of-strings) (define-maybe/no-serialization package) (define-maybe/no-serialization subid-range) @@ -603,8 +613,9 @@ This field will override the @code{group} field of @code{oci-configuration}.") (list-of-strings '()) "Overwrite the default command (@code{CMD}) of the image.") (entrypoint - (maybe-string) - "Overwrite the default entrypoint (@code{ENTRYPOINT}) of the image.") + (maybe-string-or-list-of-strings) + "Overwrite the default entrypoint (@code{ENTRYPOINT}) of the image. It can +be either a string, or a list of strings.") (host-environment (oci-container-host-environment '()) "Set environment variables in the host environment where @command{docker run} @@ -962,7 +973,10 @@ for the OCI runtime run command." (apply append (filter (compose not unspecified?) (list (if (maybe-value-set? entrypoint) - `("--entrypoint" ,entrypoint) + `("--entrypoint" + ,(if (list? entrypoint) + (string-join entrypoint " ") + entrypoint)) '()) (append-map (lambda (spec) -- cgit v1.3