unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* guix pack: support for something similar to Nix's buildLayeredImage
@ 2023-08-09 12:59 Simon Pugnet
  2023-08-10  1:07 ` Hilton Chain
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Pugnet @ 2023-08-09 12:59 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 2795 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: guix pack: support for something similar to Nix's buildLayeredImage
  2023-08-09 12:59 guix pack: support for something similar to Nix's buildLayeredImage Simon Pugnet
@ 2023-08-10  1:07 ` Hilton Chain
  2023-08-10  7:14   ` Simon Pugnet
  0 siblings, 1 reply; 3+ messages in thread
From: Hilton Chain @ 2023-08-10  1:07 UTC (permalink / raw)
  To: Simon Pugnet; +Cc: help-guix

Hi Simon,

On Wed, 09 Aug 2023 20:59:02 +0800,
Simon Pugnet wrote:
>
> 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?

It's currently not available in Guix, but there's a patch series
<https://issues.guix.gnu.org/62153> for it.

Thanks


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: guix pack: support for something similar to Nix's buildLayeredImage
  2023-08-10  1:07 ` Hilton Chain
@ 2023-08-10  7:14   ` Simon Pugnet
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Pugnet @ 2023-08-10  7:14 UTC (permalink / raw)
  To: Hilton Chain; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

Hi Hilton,

Hilton Chain <hako@ultrarare.space> writes:

> Hi Simon,
>
> On Wed, 09 Aug 2023 20:59:02 +0800,
> Simon Pugnet wrote:
>>
>> 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?
>
> It's currently not available in Guix, but there's a patch series
> <https://issues.guix.gnu.org/62153> for it.
>
> Thanks

Excellent, thanks for pointing that out, and sorry for missing it in 
my searches!

Kind regards,

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-10 20:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-09 12:59 guix pack: support for something similar to Nix's buildLayeredImage Simon Pugnet
2023-08-10  1:07 ` Hilton Chain
2023-08-10  7:14   ` Simon Pugnet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).