summaryrefslogtreecommitdiffstats
path: root/nixos/tests/docker-tools-overlay.nix
blob: 0dada1d32e5a65cc984394d0f9af6ef3e1f84703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# this test creates a simple GNU image with docker tools and sees if it executes
{ pkgs, ... }:
{
  name = "docker-tools-overlay";
  meta = with pkgs.lib.maintainers; {
    maintainers = [
      roberth
    ];
  };

  nodes = {
    docker =
      { ... }:
      {
        virtualisation.docker.enable = true;
        virtualisation.docker.storageDriver = "overlay2";
      };
  };

  testScript = ''
    docker.wait_for_unit("sockets.target")

    docker.succeed(
        "docker load --input='${pkgs.dockerTools.examples.bash}'",
        "docker run --rm ${pkgs.dockerTools.examples.bash.imageName} bash --version",
    )

    # Check if the nix store has correct user permissions depending on what
    # storage driver is used, incorrectly built images can show up as readonly.
    # drw-------  3 0 0   3 Apr 14 11:36 /nix
    # drw------- 99 0 0 100 Apr 14 11:36 /nix/store
    docker.succeed("docker run --rm -u 1000:1000 ${pkgs.dockerTools.examples.bash.imageName} bash --version")
  '';
}