1 # This test runs docker-registry and check if it works
3 import ./make-test-python.nix ({ pkgs, ...} : {
4 name = "docker-registry";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ globin ma27 ironpinguin ];
11 services.dockerRegistry.enable = true;
12 services.dockerRegistry.enableDelete = true;
13 services.dockerRegistry.port = 8080;
14 services.dockerRegistry.listenAddress = "0.0.0.0";
15 services.dockerRegistry.enableGarbageCollect = true;
16 networking.firewall.allowedTCPPorts = [ 8080 ];
20 virtualisation.docker.enable = true;
21 virtualisation.docker.extraOptions = "--insecure-registry registry:8080";
25 virtualisation.docker.enable = true;
26 virtualisation.docker.extraOptions = "--insecure-registry registry:8080";
32 client1.wait_for_unit("docker.service")
33 client1.succeed("tar cv --files-from /dev/null | docker import - scratch")
34 client1.succeed("docker tag scratch registry:8080/scratch")
37 registry.wait_for_unit("docker-registry.service")
38 registry.wait_for_open_port(8080)
39 client1.succeed("docker push registry:8080/scratch")
42 client2.wait_for_unit("docker.service")
43 client2.succeed("docker pull registry:8080/scratch")
44 client2.succeed("docker images | grep scratch")
47 "curl -fsS -X DELETE registry:8080/v2/scratch/manifests/$(curl -fsS -I -H\"Accept: application/vnd.docker.distribution.manifest.v2+json\" registry:8080/v2/scratch/manifests/latest | grep Docker-Content-Digest | sed -e 's/Docker-Content-Digest: //' | tr -d '\\r')"
50 registry.systemctl("start docker-registry-garbage-collect.service")
51 registry.wait_until_fails("systemctl status docker-registry-garbage-collect.service")
52 registry.wait_for_unit("docker-registry.service")
54 registry.fail("ls -l /var/lib/docker-registry/docker/registry/v2/blobs/sha256/*/*/data")
56 client1.succeed("docker push registry:8080/scratch")
58 "ls -l /var/lib/docker-registry/docker/registry/v2/blobs/sha256/*/*/data"