mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 21:21:06 +00:00
508343962e
- the `imageFile` option allows to load an image from a derivation - the `dependsOn` option can be used to specify dependencies between container systemd units. Co-authored-by: Christian Höppner <mkaito@users.noreply.github.com>
31 lines
675 B
Nix
31 lines
675 B
Nix
# Test Docker containers as systemd units
|
|
|
|
import ./make-test.nix ({ pkgs, lib, ... }:
|
|
|
|
{
|
|
name = "docker-containers";
|
|
meta = {
|
|
maintainers = with lib.maintainers; [ benley mkaito ];
|
|
};
|
|
|
|
nodes = {
|
|
docker = { pkgs, ... }:
|
|
{
|
|
virtualisation.docker.enable = true;
|
|
|
|
docker-containers.nginx = {
|
|
image = "nginx-container";
|
|
imageFile = pkgs.dockerTools.examples.nginx;
|
|
ports = ["8181:80"];
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
startAll;
|
|
$docker->waitForUnit("docker-nginx.service");
|
|
$docker->waitForOpenPort(8181);
|
|
$docker->waitUntilSucceeds("curl http://localhost:8181|grep Hello");
|
|
'';
|
|
})
|