services: oci-container: Fix provided image is string.

gnu/services/docker.scm (oci-container-shepherd-service): When image is
oci-image, call %oci-image-loader.

Change-Id: I26105e82643affe9e7037975e42ec9690089545b
This commit is contained in:
Zheng Junjie 2024-05-27 13:53:01 +08:00
parent 425cf1fbe2
commit 2b2337f275
No known key found for this signature in database
GPG key ID: 3B5AA993E1A2DFF0

View file

@ -687,18 +687,19 @@ (define (guess-name name image)
(if (oci-image? image) name image) "."))
(start
#~(lambda ()
(when #$(oci-image? image)
(invoke #$(%oci-image-loader
name image image-reference)))
(fork+exec-command
;; docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
(list #$docker "run" "--rm" "--name" #$name
#$@options #$@extra-arguments
#$image-reference #$@command)
#:user #$user
#:group #$group
#:environment-variables
(list #$@host-environment))))
#$@(if (oci-image? image)
#~((invoke #$(%oci-image-loader
name image image-reference)))
#~())
(fork+exec-command
;; docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
(list #$docker "run" "--rm" "--name" #$name
#$@options #$@extra-arguments
#$image-reference #$@command)
#:user #$user
#:group #$group
#:environment-variables
(list #$@host-environment))))
(stop
#~(lambda _
(invoke #$docker "rm" "-f" #$name)))