diff --git a/nixos/modules/virtualisation/nixos-container.pl b/nixos/modules/virtualisation/nixos-container.pl index 5083abd84489..c0d30346e568 100644 --- a/nixos/modules/virtualisation/nixos-container.pl +++ b/nixos/modules/virtualisation/nixos-container.pl @@ -152,6 +152,7 @@ if ($action eq "create") { my $root = "/var/lib/containers/$containerName"; my $profileDir = "/nix/var/nix/profiles/per-container/$containerName"; +my $gcRootsDir = "/nix/var/nix/gcroots/per-container/$containerName"; my $confFile = "/etc/containers/$containerName.conf"; die "$0: container ‘$containerName’ does not exist\n" if !-e $confFile; @@ -172,6 +173,7 @@ if ($action eq "destroy") { stopContainer if isContainerRunning; rmtree($profileDir) if -e $profileDir; + rmtree($gcRootsDir) if -e $gcRootsDir; rmtree($root) if -e $root; unlink($confFile) or die; }