help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guix pack: support for something similar to Nix's buildLayeredImage


From: Simon Pugnet
Subject: guix pack: support for something similar to Nix's buildLayeredImage
Date: Wed, 09 Aug 2023 13:59:02 +0100

Hi,

I have been experimenting with using guix pack to build images.

Take the following examples: -

1. guix pack -f docker coreutils
2. guix pack -f docker python
3. guix pack -f docker coreutils python
4. guix pack -f docker rust
5. guix pack -f docker coreutils rust

If I then import those three (via "docker load < (store path to pack)") I see the following Docker images: -

1. coreutils latest 0ea7b529fa11 53 years ago 99.3MB 2. python latest b6ff62311ffe 53 years ago 234MB 3. coreutils-python latest 17b7d53c54f1 53 years ago 255MB 4. rust latest 71c34a198b4a 53 years ago 1.05GB 5. coreutils-rust latest 96398a0a9efd 53 years ago 1.07GB

Inspecting those images shows that they each have only a single layer: -

1. "Layers": ["sha256:0a82bb2a1af9a9e0f5c9ee48c0d103890bf520cf5fceb82be16d14f38f76c351"] 2. "Layers": ["sha256:bdf366b7105cddb8c0fecded8a41f9d34389b2d19cb7c5e0b7760bd550f83d3a"] 3. "Layers": ["sha256:361dae9e271d6ab0195ef3f8f338e03ec5114097e373197b73986ebc6bdf6cf1"] 4. "Layers": ["sha256:64cb9e95374bdcd92034ad4956160ba4855f6e092b43a77ec38e1f8c5e4caad5"] 5. "Layers": ["sha256:6c41ed1574777cd49d25e48d78d4e9070d9549c5c263f9f708af2c7e9f05f357"]

Examining the image storage directories for each shows them to have the following sizes (in bytes): -
1.   99349355
2.  234345507
3.  255198424 (~20MB larger)
4. 1046735591
5. 1067588316 (~20MB larger)

The problem with this is that for example the coreutils-python image contains coreutils as does any other image that happens to use coreutils like the example coreutils-rust. Examining the actual coreutils directory size in each image (/gnu/store/yr39rh6wihd1wv6gzf7w4w687dwzf3vb-coreutils-9.1) shows that it's 17131414 bytes in size, which corresponds approximately to the size increase I'm seeing in coreutils-python and coreutils-rust.

I'm not a Guix or Nix expert but as far as I understand Nix solves this problem by using "pkgs.dockerTools.buildLayeredImage" (see http://ryantm.github.io/nixpkgs/builders/images/dockertools/#ssec-pkgs-dockerTools-buildLayeredImage) and "streamLayeredImage". In this example, this could in theory be used to build a coreutils-python image where coreutils exists in its own layer. That would mean that the coreutils-rust image could share the coreutils layer, saving space.

Is there any way to achieve something similar in Guix? If not then are there any plans to support this functionality?

Kind regards,

--
Simon Pugnet
https://www.polaris64.net/
PGP key fingerprint: 3BF7 85DE 162C 00C8 FB4D A6FD BA13 59A8 2C0B 3EF9

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]