forked from mirrors/nixpkgs
c94005358c
* WIP: Run Docker containers as declarative systemd services * PR feedback round 1 * docker-containers: add environment, ports, user, workdir options * docker-containers: log-driver, string->str, line wrapping * ExecStart instead of script wrapper, %n for container name * PR feedback: better description and example formatting * Fix docbook formatting (oops) * Use a list of strings for ports, expand documentation * docker-continers: add a simple nixos test * waitUntilSucceeds to avoid potential weird async issues * Don't enable docker daemon unless we actually need it * PR feedback: leave ExecReload undefined
30 lines
698 B
Nix
30 lines
698 B
Nix
# Test Docker containers as systemd units
|
|
|
|
import ./make-test.nix ({ pkgs, lib, ... }: {
|
|
name = "docker-containers";
|
|
meta = {
|
|
maintainers = with lib.maintainers; [ benley ];
|
|
};
|
|
|
|
nodes = {
|
|
docker = { pkgs, ... }:
|
|
{
|
|
virtualisation.docker.enable = true;
|
|
|
|
virtualisation.dockerPreloader.images = [ pkgs.dockerTools.examples.nginx ];
|
|
|
|
docker-containers.nginx = {
|
|
image = "nginx-container";
|
|
ports = ["8181:80"];
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
startAll;
|
|
$docker->waitForUnit("docker-nginx.service");
|
|
$docker->waitForOpenPort(8181);
|
|
$docker->waitUntilSucceeds("curl http://localhost:8181|grep Hello");
|
|
'';
|
|
})
|