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