scripts: system: Deprecate the docker-image command.

* guix/scripts/system.scm (system-derivation-for-action): Use the image API to
generate the docker images and deprecate the docker-image command.
(process-action): Ditto.
* doc/guix.texi (Invoking guix system): Adapt it.
This commit is contained in:
Mathieu Othacehe 2021-12-16 10:09:17 +01:00
parent 05a9d1f378
commit 3ed8ddd606
No known key found for this signature in database
GPG key ID: 8354763531769CA6
2 changed files with 17 additions and 24 deletions

View file

@ -35039,15 +35039,6 @@ QEMU monitor and the VM.
@cindex System images, creation in various formats @cindex System images, creation in various formats
@cindex Creating system images in various formats @cindex Creating system images in various formats
@item image @item image
@itemx docker-image
Return a virtual machine, disk image, or Docker image of the operating
system declared in @var{file} that stands alone. By default,
@command{guix system} estimates the size of the image needed to store
the system, but you can use the @option{--image-size} option to specify
a value. Docker images are built to contain exactly what they need, so
the @option{--image-size} option is ignored in the case of
@code{docker-image}.
@cindex image, creating disk images @cindex image, creating disk images
The @code{image} command can produce various image types. The The @code{image} command can produce various image types. The
image type can be selected using the @option{--image-type} option. It image type can be selected using the @option{--image-type} option. It
@ -35093,11 +35084,11 @@ uses the SeaBIOS BIOS by default, expecting a bootloader to be installed
in the Master Boot Record (MBR). in the Master Boot Record (MBR).
@cindex docker-image, creating docker images @cindex docker-image, creating docker images
When using @code{docker-image}, a Docker image is produced. Guix builds When using the @code{docker} image type, a Docker image is produced.
the image from scratch, not from a pre-existing Docker base image. As a Guix builds the image from scratch, not from a pre-existing Docker base
result, it contains @emph{exactly} what you define in the operating image. As a result, it contains @emph{exactly} what you define in the
system configuration file. You can then load the image and launch a operating system configuration file. You can then load the image and
Docker container using commands like the following: launch a Docker container using commands like the following:
@example @example
image_id="$(docker load < guix-system-docker-image.tar.gz)" image_id="$(docker load < guix-system-docker-image.tar.gz)"

View file

@ -713,16 +713,14 @@ (define* (system-derivation-for-action image action
image-size image-size
(* 70 (expt 2 20))) (* 70 (expt 2 20)))
#:mappings mappings)) #:mappings mappings))
((image disk-image vm-image) ((image disk-image vm-image docker-image)
(when (eq? action 'disk-image) (when (eq? action 'disk-image)
(warning (G_ "'disk-image' is deprecated: use 'image' instead~%"))) (warning (G_ "'disk-image' is deprecated: use 'image' instead~%")))
(when (eq? action 'vm-image) (when (eq? action 'vm-image)
(warning (G_ "'vm-image' is deprecated: use 'image' instead~%"))) (warning (G_ "'vm-image' is deprecated: use 'image' instead~%")))
(lower-object (system-image image))) (when (eq? action 'docker-image)
((docker-image) (warning (G_ "'docker-image' is deprecated: use 'image' instead~%")))
(system-docker-image os (lower-object (system-image image))))))
#:memory-size 1024
#:shared-network? container-shared-network?)))))
(define (maybe-suggest-running-guix-pull) (define (maybe-suggest-running-guix-pull)
"Suggest running 'guix pull' if this has never been done before." "Suggest running 'guix pull' if this has never been done before."
@ -1214,11 +1212,14 @@ (define save-provenance?
(label (assoc-ref opts 'label)) (label (assoc-ref opts 'label))
(image-type (lookup-image-type-by-name (image-type (lookup-image-type-by-name
(assoc-ref opts 'image-type))) (assoc-ref opts 'image-type)))
(image (let* ((image-type (if (eq? action 'vm-image) (image (let* ((image-type (case action
qcow2-image-type ((vm-image) qcow2-image-type)
image-type)) ((docker-image) docker-image-type)
(else image-type)))
(image-size (assoc-ref opts 'image-size)) (image-size (assoc-ref opts 'image-size))
(volatile? (assoc-ref opts 'volatile-root?)) (volatile? (assoc-ref opts 'volatile-root?))
(shared-network?
(assoc-ref opts 'container-shared-network?))
(base-image (if (operating-system? obj) (base-image (if (operating-system? obj)
(os->image obj (os->image obj
#:type image-type) #:type image-type)
@ -1228,7 +1229,8 @@ (define save-provenance?
(image-with-label base-image label) (image-with-label base-image label)
base-image)) base-image))
(size image-size) (size image-size)
(volatile-root? volatile?)))) (volatile-root? volatile?)
(shared-network? shared-network?))))
(os (image-operating-system image)) (os (image-operating-system image))
(target-file (match args (target-file (match args
((first second) second) ((first second) second)