2018-04-14 12:41:23 +01:00
|
|
|
# this test creates a simple GNU image with docker tools and sees if it executes
|
|
|
|
|
2019-12-06 06:45:49 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }:
|
2018-04-14 12:41:23 +01:00
|
|
|
{
|
|
|
|
name = "docker-tools-overlay";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2021-05-08 14:00:19 +01:00
|
|
|
maintainers = [ lnl7 roberth ];
|
2018-04-14 12:41:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
docker =
|
2018-07-20 21:56:59 +01:00
|
|
|
{ ... }:
|
2018-04-14 12:41:23 +01:00
|
|
|
{
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
virtualisation.docker.storageDriver = "overlay"; # defaults to overlay2
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-12-06 06:45:49 +00:00
|
|
|
testScript = ''
|
|
|
|
docker.wait_for_unit("sockets.target")
|
2018-04-14 12:41:23 +01:00
|
|
|
|
2019-12-06 06:45:49 +00:00
|
|
|
docker.succeed(
|
|
|
|
"docker load --input='${pkgs.dockerTools.examples.bash}'",
|
|
|
|
"docker run --rm ${pkgs.dockerTools.examples.bash.imageName} bash --version",
|
|
|
|
)
|
2018-04-14 12:41:23 +01:00
|
|
|
|
|
|
|
# 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
|
2019-12-06 06:45:49 +00:00
|
|
|
docker.succeed("docker run --rm -u 1000:1000 ${pkgs.dockerTools.examples.bash.imageName} bash --version")
|
2018-04-14 12:41:23 +01:00
|
|
|
'';
|
|
|
|
})
|