Message ID | 20230313003012.14325-1-go.wigust@gmail.com |
---|---|
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D14BF16DC2; Mon, 13 Mar 2023 00:31:18 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1527E16D7C for <patchwork@mira.cbaines.net>; Mon, 13 Mar 2023 00:31:15 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1pbW5g-0006XO-W3; Sun, 12 Mar 2023 20:31:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1pbW5f-0006X0-83 for guix-patches@gnu.org; Sun, 12 Mar 2023 20:31:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1pbW5f-0004Ji-0K for guix-patches@gnu.org; Sun, 12 Mar 2023 20:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1pbW5e-0007Hc-Eh for guix-patches@gnu.org; Sun, 12 Mar 2023 20:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62153] [PATCH 0/2] Add Docker layered image for pack and system Resent-From: Oleg Pykhalov <go.wigust@gmail.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Mar 2023 00:31:02 +0000 Resent-Message-ID: <handler.62153.B.167866744227967@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62153 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62153@debbugs.gnu.org Cc: Oleg Pykhalov <go.wigust@gmail.com> X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167866744227967 (code B ref -1); Mon, 13 Mar 2023 00:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Mar 2023 00:30:42 +0000 Received: from localhost ([127.0.0.1]:33230 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1pbW5K-0007H1-33 for submit@debbugs.gnu.org; Sun, 12 Mar 2023 20:30:42 -0400 Received: from lists.gnu.org ([209.51.188.17]:40538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <go.wigust@gmail.com>) id 1pbW5H-0007Gp-SA for submit@debbugs.gnu.org; Sun, 12 Mar 2023 20:30:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <go.wigust@gmail.com>) id 1pbW52-0006Nd-TL for guix-patches@gnu.org; Sun, 12 Mar 2023 20:30:29 -0400 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <go.wigust@gmail.com>) id 1pbW50-0004AQ-Ve for guix-patches@gnu.org; Sun, 12 Mar 2023 20:30:24 -0400 Received: by mail-lf1-x12d.google.com with SMTP id i28so13692524lfv.0 for <guix-patches@gnu.org>; Sun, 12 Mar 2023 17:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678667420; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ucOGKy6q5g61a7cNcRVcCF7YuvL0G2HspA1lHquPyoI=; b=dmWQKNdZHnsZZ8YLurOVG4qE+0yOLrPVrdpqNnjg/nQziq9wRMTwmgMLztci2LCJPx 9wWOzRW7Uq29RTipvKoqXc/Ok3rxT+RkTKq2qJCaQibWFnvFg7ACenNpiqRxy2Usihnz EcBXA8sKSAEOGitpTcUXX90TQEFtLlmhBvRgKy5tA6EXoJhWrzOxXP0o7xWeA5elwrIT 58iFPVGzKWqarbDZCGta1u7cYywjM/ru7ojzcsGXNId4bd4kVOCu0K0e9Sku0haz56+v dkPB3yhnf7HbE0m7Kyi2F00eanQcToqFQionf+OQqxn1cfF7zKJQsW3ZpmZiTlFsbAle phkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678667420; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ucOGKy6q5g61a7cNcRVcCF7YuvL0G2HspA1lHquPyoI=; b=SJDjwtKKVLGSYQVS8IedI3Kt8Fs71hTmOL0uJ2FEUsIOF3jHjCHfIwwg9cehhynYXL UVf/w30+VljMWEOvVe16S+sUlUaiIbSWo/s7qcZ/E4v/Yk6kmoS7s9i4DSzakGNrb8XE v7uRbCv54ZG72zKqvIYa1K3uYoRSyj6cWaQ4KTBDHCpoznappJVF0RHFBQqsFxuH4Dib GTWIcV+rCnE4O8PL6SHySUa23e6tU48IhxqXvf5pgg4RziwM8nH6jP1NgrBd4FF+aPPm ciXfwpkj3Yw7EhHpzaWmtAaZ0CBp2d05YFUr4Uee2oHu7+KeWfdHaNtbrsswgVosTPNT r5Hw== X-Gm-Message-State: AO0yUKUAaOl6Qo/RBRWLEaYA2hGXLfKT06rxFmUtJSCjUFV7a1vAuzsT 3Lozqa0Bi5nt/peGmRzht8kLS9wZU6E= X-Google-Smtp-Source: AK7set+n2TbEn9QKPt+FAD2Fzf53FWyE8aMVQxaoS7AVZe9d18Bd6RuMKhHCCNqOullwF8mZSy650A== X-Received: by 2002:a19:f51a:0:b0:4b6:e4c8:8a4e with SMTP id j26-20020a19f51a000000b004b6e4c88a4emr2563834lfb.0.1678667419979; Sun, 12 Mar 2023 17:30:19 -0700 (PDT) Received: from guixsd.wugi.info ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id q11-20020ac246eb000000b004db3bee9a32sm785269lfo.283.2023.03.12.17.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 17:30:19 -0700 (PDT) From: Oleg Pykhalov <go.wigust@gmail.com> Date: Mon, 13 Mar 2023 03:30:12 +0300 Message-Id: <20230313003012.14325-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.38.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=go.wigust@gmail.com; helo=mail-lf1-x12d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Series |
Add Docker layered image for pack and system
|
|
Message
Oleg Pykhalov
March 13, 2023, 12:30 a.m. UTC
Hi Guix, This patch series add to 'guix pack' and 'guix system image' formats with a layered Docker image, which dicreases images size by sharing same layers on a host. The folling commands show an example for new image formats: ./pre-inst-env guix system image --image-type=docker-layered config.scm docker load -i result ./pre-inst-env guix pack -f docker --entry-point=bin/bash -S /bin=bin bash hello docker load -i result The folloing tests passed: make check-channel-news make check TESTS="tests/pack.scm" make check-system TESTS="docker-system docker-layered-system" The gnu/packages/aux-files/python/stream-layered-image.py Python script is a copy of github.com/NixOS/nixpkgs/pkgs/build-support/docker/stream_layered_image.py with only a simple replacement "/nix" to "/gnu" string. Oleg Pykhalov (2): guix: docker: Build layered image. news: Add entry for the new 'docker-layered' distribution format. Makefile.am | 3 +- doc/guix.texi | 16 +- etc/news.scm | 38 ++ gnu/image.scm | 3 +- .../aux-files/python/stream-layered-image.py | 391 ++++++++++++++++++ gnu/system/image.scm | 84 +++- gnu/tests/docker.scm | 20 +- guix/docker.scm | 182 ++++++-- guix/scripts/pack.scm | 103 +++-- guix/scripts/system.scm | 11 +- tests/pack.scm | 48 +++ 11 files changed, 813 insertions(+), 86 deletions(-) create mode 100644 gnu/packages/aux-files/python/stream-layered-image.py base-commit: 60a211ec705ac98483d76da7f2523f2b8966343a
Comments
The cover lever guix pack example should be: ./pre-inst-env guix pack -f docker-layered --entry-point=bin/bash -S /bin=bin bash hello instead of ./pre-inst-env guix pack -f docker --entry-point=bin/bash -S /bin=bin bash hello Apologies, Oleg.
Hi, Guix. These patches series is rebased on origin/master. Also, the Python script is replaced in favour of calls to GNU Tar and GNU Gzip programs. Passed tests: make check TESTS="tests/pack.scm" make check-system TESTS="docker-system" make check-system TESTS="docker-layered-system" Oleg Pykhalov (2): guix: docker: Build layered image. news: Add entry for the new 'docker-layered' distribution format. doc/guix.texi | 18 +++- etc/news.scm | 58 ++++++++++++ gnu/image.scm | 3 +- gnu/system/image.scm | 76 +++++++++++---- gnu/tests/docker.scm | 20 +++- guix/docker.scm | 205 +++++++++++++++++++++++++++++++--------- guix/scripts/pack.scm | 62 ++++++++++-- guix/scripts/system.scm | 11 ++- tests/pack.scm | 48 ++++++++++ 9 files changed, 424 insertions(+), 77 deletions(-) base-commit: 77f52db416a13e195d090cad4e9e7658feb2e86b
On Wed, May 31, 2023 at 4:46 AM Oleg Pykhalov <go.wigust@gmail.com> wrote: > > Hi, Guix. > > These patches series is rebased on origin/master. Also, the Python script is > replaced in favour of calls to GNU Tar and GNU Gzip programs. Passed tests: > make check TESTS="tests/pack.scm" > make check-system TESTS="docker-system" > make check-system TESTS="docker-layered-system" > > > Oleg Pykhalov (2): > guix: docker: Build layered image. > news: Add entry for the new 'docker-layered' distribution format. Why not use layered images for all docker packs?
Greg Hogan <code@greghogan.com> writes: > On Wed, May 31, 2023 at 4:46 AM Oleg Pykhalov <go.wigust@gmail.com> wrote: >> >> Hi, Guix. >> >> These patches series is rebased on origin/master. Also, the Python script is >> replaced in favour of calls to GNU Tar and GNU Gzip programs. Passed tests: >> make check TESTS="tests/pack.scm" >> make check-system TESTS="docker-system" >> make check-system TESTS="docker-layered-system" >> >> >> Oleg Pykhalov (2): >> guix: docker: Build layered image. >> news: Add entry for the new 'docker-layered' distribution format. > > Why not use layered images for all docker packs? Do you mean use layered images by default without ability to build all in a single layer? Current layered implementation is slow to build because it needs to calculate a size of each layer, pack, and compress. So if user wants a faster build, a non-layered image is still an option. Regards, Oleg.
On Wed, May 31, 2023 at 9:14 AM Oleg Pykhalov <go.wigust@gmail.com> wrote: [...] > Do you mean use layered images by default without ability to build all > in a single layer? Current layered implementation is slow to build > because it needs to calculate a size of each layer, pack, and compress. > So if user wants a faster build, a non-layered image is still an option. > > Regards, > Oleg. I am trying out your patch, and wanted to benchmark the runtime difference between docker and docker-layered packs, but the latter looks to be failing with any compression other than the default gzip. In particular, I was looking to disable compression with '--compression=none'.
Greg Hogan <code@greghogan.com> writes: > On Wed, May 31, 2023 at 9:14 AM Oleg Pykhalov <go.wigust@gmail.com> wrote: > [...] >> Do you mean use layered images by default without ability to build all >> in a single layer? Current layered implementation is slow to build >> because it needs to calculate a size of each layer, pack, and compress. >> So if user wants a faster build, a non-layered image is still an option. >> >> Regards, >> Oleg. > > I am trying out your patch, and wanted to benchmark the runtime > difference between docker and docker-layered packs, but the latter > looks to be failing with any compression other than the default gzip. > In particular, I was looking to disable compression with > '--compression=none'. I'll send a fixed v4 revision for '--compression=none'. Unfortunately, because we cannot append to an existing compressed tarball: tar: Cannot update compressed archives Try 'tar --help' or 'tar --usage' for more information. adding more compression types requires to write a handler for every compressor separately in guix/docker.scm file: --8<---------------cut here---------------start------------->8--- (if layered-image? (begin (invoke "tar" "-rf" "image.tar" "config.json") (if compressor (begin (apply invoke `(,@compressor "image.tar")) (copy-file "image.tar.gz" image)) (copy-file "image.tar" image))) --8<---------------cut here---------------end--------------->8--- I would like to vote that addional compressors could be added later if needed. Regards, Oleg.
Hi Guix, I would like to merge 62153. After 64173 will be merge, merging 62153 is not possible without conflict resolving with Git. 64173 introduces ‘%docker-format-options’ variable. With this variable it's possible in 62153 to replace ‘--image-type=docker-layered’ with ‘--docker-layers=N’ option, where: if ‘N’ is zero, then use current non layered format if ‘N’ is bigger than zero, then use layered format Number of layers specification is nice to have, because Docker layers are limited. So if user would like to modify a Docker image by adding more layers on top, then hacks like squashing layers are not required. Also, it will be possible to delete code which builds non layered Docker image without deprecating command line options. Is it possible to partially merge 64173, specifically ‘%docker-format-options’ variable and it requirements, so it can be used in 62153 for ‘--docker-layers=N’ option? [1]: https://issues.guix.gnu.org/issue/62153 [2]: https://issues.guix.gnu.org/64173 Regards, Oleg.