Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bfa0e4345e6b
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0e28092a561f
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jun 6, 2019

  1. nixos/tests/docker-tools: check layer sharing with buildLayeredImage

    Adapted from grahamc's blog post on layered Docker images in Nix:
    
    https://grahamc.com/blog/nix-and-layered-docker-images
    danieldk committed Jun 6, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    elevenfive Matthew Zavislak
    Copy the full SHA
    3b0d5b5 View commit details

Commits on Jun 8, 2019

  1. Merge pull request #62773 from danieldk/docker-shared-layer-test

    nixos/tests/docker-tools: check layer sharing with buildLayeredImage
    nlewo authored Jun 8, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0e28092 View commit details
Showing with 14 additions and 0 deletions.
  1. +6 −0 nixos/tests/docker-tools.nix
  2. +8 −0 pkgs/build-support/docker/examples.nix
6 changes: 6 additions & 0 deletions nixos/tests/docker-tools.nix
Original file line number Diff line number Diff line change
@@ -68,6 +68,12 @@ import ./make-test.nix ({ pkgs, ... }: {
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.layered-on-top}'");
$docker->succeed("docker run --rm ${pkgs.dockerTools.examples.layered-on-top.imageName}");
# Ensure layers are shared between images
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.another-layered-image}'");
$docker->succeed("docker inspect ${pkgs.dockerTools.examples.layered-image.imageName} | ${pkgs.jq}/bin/jq -r '.[] | .RootFS.Layers | .[]' | sort > layers1.sha256");
$docker->succeed("docker inspect ${pkgs.dockerTools.examples.another-layered-image.imageName} | ${pkgs.jq}/bin/jq -r '.[] | .RootFS.Layers | .[]' | sort > layers2.sha256");
$docker->succeed('[ $(comm -1 -2 layers1.sha256 layers2.sha256 | wc -l) -ne 0 ]');
# Ensure order of layers is correct
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.layersOrder}'");
$docker->succeed("docker run --rm ${pkgs.dockerTools.examples.layersOrder.imageName} cat /tmp/layer1 | grep -q layer1");
8 changes: 8 additions & 0 deletions pkgs/build-support/docker/examples.nix
Original file line number Diff line number Diff line change
@@ -226,4 +226,12 @@ rec {
'';
};

# 14. Create another layered image, for comparing layers with image 10.
another-layered-image = pkgs.dockerTools.buildLayeredImage {
name = "another-layered-image";
tag = "latest";
config.Cmd = [ "${pkgs.hello}/bin/hello" ];
contents = [ pkgs.hello ];
};

}