Merge pull request #38933 from LnL7/docker-tools-overlay
docker-tools: add a test for permissions issues with AUFS/overlay
This commit is contained in:
@@ -266,6 +266,7 @@ in rec {
|
|||||||
tests.couchdb = callTest tests/couchdb.nix {};
|
tests.couchdb = callTest tests/couchdb.nix {};
|
||||||
tests.docker = callTestOnMatchingSystems ["x86_64-linux"] tests/docker.nix {};
|
tests.docker = callTestOnMatchingSystems ["x86_64-linux"] tests/docker.nix {};
|
||||||
tests.docker-tools = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools.nix {};
|
tests.docker-tools = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools.nix {};
|
||||||
|
tests.docker-tools-overlay = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-tools-overlay.nix {};
|
||||||
tests.docker-edge = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-edge.nix {};
|
tests.docker-edge = callTestOnMatchingSystems ["x86_64-linux"] tests/docker-edge.nix {};
|
||||||
tests.dovecot = callTest tests/dovecot.nix {};
|
tests.dovecot = callTest tests/dovecot.nix {};
|
||||||
tests.dnscrypt-proxy = callTestOnMatchingSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
|
tests.dnscrypt-proxy = callTestOnMatchingSystems ["x86_64-linux"] tests/dnscrypt-proxy.nix {};
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# this test creates a simple GNU image with docker tools and sees if it executes
|
||||||
|
|
||||||
|
import ./make-test.nix ({ pkgs, ... }:
|
||||||
|
{
|
||||||
|
name = "docker-tools-overlay";
|
||||||
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
|
maintainers = [ lnl7 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
docker =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
virtualisation.docker.enable = true;
|
||||||
|
virtualisation.docker.storageDriver = "overlay"; # defaults to overlay2
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript =
|
||||||
|
''
|
||||||
|
$docker->waitForUnit("sockets.target");
|
||||||
|
|
||||||
|
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.bash}'");
|
||||||
|
$docker->succeed("docker run --rm ${pkgs.dockerTools.examples.bash.imageName} bash --version");
|
||||||
|
|
||||||
|
# Check if the nix store has correct user permissions depending on what
|
||||||
|
# storage driver is used, incorrectly built images can show up as readonly.
|
||||||
|
# drw------- 3 0 0 3 Apr 14 11:36 /nix
|
||||||
|
# drw------- 99 0 0 100 Apr 14 11:36 /nix/store
|
||||||
|
$docker->succeed("docker run --rm -u 1000:1000 ${pkgs.dockerTools.examples.bash.imageName} bash --version");
|
||||||
|
'';
|
||||||
|
})
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
import ./make-test.nix ({ pkgs, ... }: {
|
import ./make-test.nix ({ pkgs, ... }: {
|
||||||
name = "docker-tools";
|
name = "docker-tools";
|
||||||
meta = with pkgs.stdenv.lib.maintainers; {
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
maintainers = [ ];
|
maintainers = [ lnl7 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
@@ -21,12 +21,12 @@ import ./make-test.nix ({ pkgs, ... }: {
|
|||||||
$docker->waitForUnit("sockets.target");
|
$docker->waitForUnit("sockets.target");
|
||||||
|
|
||||||
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.bash}'");
|
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.bash}'");
|
||||||
$docker->succeed("docker run --rm ${pkgs.dockerTools.examples.bash.imageName} /bin/bash --version");
|
$docker->succeed("docker run --rm ${pkgs.dockerTools.examples.bash.imageName} bash --version");
|
||||||
$docker->succeed("docker rmi ${pkgs.dockerTools.examples.bash.imageName}");
|
$docker->succeed("docker rmi ${pkgs.dockerTools.examples.bash.imageName}");
|
||||||
|
|
||||||
# Check if the nix store is correctly initialized by listing dependencies of the installed Nix binary
|
# Check if the nix store is correctly initialized by listing dependencies of the installed Nix binary
|
||||||
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.nix}'");
|
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.nix}'");
|
||||||
$docker->succeed("docker run --rm ${pkgs.dockerTools.examples.nix.imageName} /bin/nix-store -qR ${pkgs.nix}");
|
$docker->succeed("docker run --rm ${pkgs.dockerTools.examples.nix.imageName} nix-store -qR ${pkgs.nix}");
|
||||||
$docker->succeed("docker rmi ${pkgs.dockerTools.examples.nix.imageName}");
|
$docker->succeed("docker rmi ${pkgs.dockerTools.examples.nix.imageName}");
|
||||||
|
|
||||||
# To test the pullImage tool
|
# To test the pullImage tool
|
||||||
|
|||||||
Reference in New Issue
Block a user