2019-03-24 23:59:09 +01:00
|
|
|
# Test Docker containers as systemd units
|
|
|
|
|
2020-01-28 22:00:54 +01:00
|
|
|
import ./make-test.nix ({ pkgs, lib, ... }:
|
|
|
|
|
|
|
|
{
|
2019-03-24 23:59:09 +01:00
|
|
|
name = "docker-containers";
|
|
|
|
meta = {
|
2020-01-28 22:00:54 +01:00
|
|
|
maintainers = with lib.maintainers; [ benley mkaito ];
|
2019-03-24 23:59:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
docker = { pkgs, ... }:
|
|
|
|
{
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
|
|
|
|
docker-containers.nginx = {
|
|
|
|
image = "nginx-container";
|
2020-01-28 22:00:54 +01:00
|
|
|
imageFile = pkgs.dockerTools.examples.nginx;
|
2019-03-24 23:59:09 +01:00
|
|
|
ports = ["8181:80"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
$docker->waitForUnit("docker-nginx.service");
|
|
|
|
$docker->waitForOpenPort(8181);
|
|
|
|
$docker->waitUntilSucceeds("curl http://localhost:8181|grep Hello");
|
|
|
|
'';
|
|
|
|
})
|