2018-04-14 11:41:23 +00: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 11:41:23 +00:00
|
|
|
{
|
|
|
|
name = "docker-tools-overlay";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2021-05-08 13:00:19 +00:00
|
|
|
maintainers = [ lnl7 roberth ];
|
2018-04-14 11:41:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
docker =
|
2018-07-20 20:56:59 +00:00
|
|
|
{ ... }:
|
2018-04-14 11:41:23 +00: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 11:41:23 +00: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 11:41:23 +00: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 11:41:23 +00:00
|
|
|
'';
|
|
|
|
})
|