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