Skip to content

dockerTools: exportImage fails with images with more than 16 layers #392421

@charles-dyfis-net

Description

@charles-dyfis-net

Nixpkgs version

  • Stable (24.11)

Describe the bug

When attempting to export an image with more than 16 layers, dockerTools.exportImage fails with a mount error (on account of the mount -t overlay command failing).

To fix this, we should stack overlay filesystems as necessary

Steps to reproduce

Running nix-build against the file below reliably reproduces the error against all three of 24.05, 24.11, and current unstable. (In current unstable the output is different insofar as a kernel panic is shown -- but this is merely to the effect that init exited, not describing the mount failure or its cause).

let
  pkgs = import <nixpkgs> {};
  inherit (pkgs) dockerTools;
  # Retrieved with: nix-prefetch-docker --image-name concourse/git-resource --image-tag 1.17.0 --arch arm64
  concourseGitResource = {
    imageName = "concourse/git-resource";
    imageDigest = "sha256:d2395b9ba889eda03f2c782e2ad8fe31920dd72a4fd49a11f4bd42b813999674";
    sha256 = "15xdzlxjg28bky9fcyxphc15asdh1958m9mjfzxnglbr12kmcqjs";
    finalImageName = "concourse/git-resource";
    finalImageTag = "1.17.0";
  };
  upstreamImage = dockerTools.pullImage concourseGitResource;
in dockerTools.exportImage {
  name = "concourse-git-resource";
  fromImage = upstreamImage;
  fromImageName = concourseGitResource.finalImageName;
  fromImageTag = concourseGitResource.finalImageTag;
  diskSize = 2048;
}

Expected behaviour

The build should have resulted in a tarball with the contents of the image.

Screenshots

No response

Relevant log output

Formatting './image/disk-image.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2147483648 lazy_refcounts=off refcount_bits=16
SeaBIOS (version rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org)


iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+1EFD0C20+1EF30C20 CA00
Press Ctrl-B to configure iPXE (PCI 00:03.0)...^M                                                                               


Booting from ROM...
Probing EDD (edd=off to disable)... ok^M[    0.173316] sgx: There are zero EPC sections.
loading kernel modules...
mounting Nix store...
mounting host's temporary directory...
starting stage 2 (/nix/store/yk31siv5bnp4fhsv0hf0c3v3zjpkki0l-vm-run-stage2)
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done                            
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 156df29b-5cd2-4662-8370-4c647e78239f
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

Unpacking base image...
Unpacking layer 270a1170e7e398434ff1b31e17e233f7d7b71aa99a40473615860068e86720af.tar
Unpacking layer 69e7e9143c29e5bb6533dd6d139a74bc8debb7a588217c38eb0b0b792056e0ea.tar
Unpacking layer 1f5a07f2fc66d9e8121aea9102bbb98072d21bad0c3ee6ef02aa8afa4d0cf85b.tar
Unpacking layer 1ff5e081e9bc7b11362171e0ec53e158ed6d1d3ccb06256eb3ab7e455f48f70f.tar
Unpacking layer cbe38ea56691af23ea5e50d415bad855b91b58db326081633ea0a63faf7334f5.tar
Unpacking layer 04baac603add8de04ad0b2cfdb320ea85999ddbe37de014628ec69777b6211ac.tar
Unpacking layer 94e1c4ba341be7c232d5dbd3cd10b3f40226ee28becbb30cd2be815d379ecf75.tar
Unpacking layer 0c2c9dfc02ff119b6af7e8b6d82c7fab3165bac702cf5bc3bbe4f8f92828de5f.tar
Unpacking layer bf38d4c3de775a3a454fb864a5bfd1052d1ccf474722b391a224645bef4e16a3.tar
Unpacking layer b655a068a083fdbc3ffcfb06efbb6793d486306bf04252c5ed7277ee52bc421f.tar
Unpacking layer 75b04bbf0c6a9b50492d5c71a9afcc3441767fa1cf6cafab468af7145cd0549f.tar
Unpacking layer bc687e6b053ddd6d08c25dc5221ba74ea218a975c19f543ee260efcbfc2232e9.tar
Unpacking layer 083e1570a27310835abaf82e880a3a6d1540b6a9ae46e1a884fa5eaf359f8151.tar
Unpacking layer 9cf21bd3fed7f0b65dad84f83e3abfe85def46a557b8669379586bbe65c45ceb.tar
Unpacking layer bbf7029d408e691ac08fe63357121dc6d0f7ae9a7e3ed4e61c48e419cd6e3270.tar
Unpacking layer fc9621bcf70d5b2f524b46a03deef5dce7cb2ea0c0172f8839886c007d49a535.tar
Unpacking layer 76d3e64ce93b5c169dd0ac61f2e62156a312fdc0ba96f8ae0c49e4131b6ebb0f.tar
Unpacking layer 44de41253c6f4d39420315933aae8b41fb924711a60a1274dfb791f10351c308.tar
Unpacking layer 5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef.tar
mount: /tmp/disk/mnt: wrong fs type, bad option, bad superblock on overlay, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.
[   13.304391] reboot: Power down

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.13.7, NixOS, 24.11 (Vicuna), 24.11.715729.a1185f4064c1
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.24.12
  • channels(root): "nixos-24.11, nixos-unstable, nixpkgs-unstable"
  • channels(chaduffy): "nixos-23.05"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Notify maintainers

@Mic92


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions