diff options
| author | Giacomo Leidi <therewasa@fishinthecalculator.me> | 2025-10-25 22:35:51 +0200 |
|---|---|---|
| committer | Sharlatan Hellseher <sharlatanus@gmail.com> | 2026-02-25 22:17:41 +0000 |
| commit | bfa4e179e285d6521351a9d8eea6074630bbe62a (patch) | |
| tree | e2ecbfb9213d2973eb1ec1452919453e7e22bd93 /gnu | |
| parent | 9f976927fc15ca5cce3fc527dc2a4844d113a4f7 (diff) | |
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 <writer@owenh.net>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/services/containers.scm | 20 |
1 files changed, 17 insertions, 3 deletions
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) |
