1 # This test runs docker and checks if simple container starts
3 import ./make-test-python.nix (
6 name = "docker-rootless";
7 meta = with pkgs.lib.maintainers; {
8 maintainers = [ abbradar ];
15 virtualisation.docker.rootless.enable = true;
27 user = nodes.machine.config.users.users.alice;
28 sudo = lib.concatStringsSep " " [
29 "XDG_RUNTIME_DIR=/run/user/${toString user.uid}"
30 "DOCKER_HOST=unix:///run/user/${toString user.uid}/docker.sock"
32 "--preserve-env=XDG_RUNTIME_DIR,DOCKER_HOST"
38 machine.wait_for_unit("multi-user.target")
40 machine.succeed("loginctl enable-linger alice")
41 machine.wait_until_succeeds("${sudo} systemctl --user is-active docker.service")
43 machine.succeed("tar cv --files-from /dev/null | ${sudo} docker import - scratchimg")
45 "${sudo} docker run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
47 machine.succeed("${sudo} docker ps | grep sleeping")
48 machine.succeed("${sudo} docker stop sleeping")