OCI containers and impermanence

Hi! Is anyone else using OCI containers together with an impermanence-based setup?

I found the directories docker is using for general storage, but it seems like deleting some of the subdirectories doesn’t break anything, so I’m clearly not supposed to persist everything there.

My two questions are:

  • what directories do you persist as cache?
  • what directories are you supposed to back up for the volumes?

As a bonus, I think we should start adding this sort of impermanence-related info to the official wiki (I’ll try to do it myself when I figure some new stuff out), although I’m not sure it’s allowed considering impermanence is a separate project.

I run docker and impermanence on a few hosts. I just persist /var/lib/docker. I don’t know the answers to your 2 questions (maybe the docker documentation will help). This is what I have in my configuration:

{
  config,
  lib,
  ...
}: {
  virtualisation.docker = {
    enable = true;
    # This is suggested on the NixOS wiki, and all my hosts use btrfs.
    storageDriver = "btrfs";
  };

  users.extraGroups.docker.members = ["david"];

  environment.persistence = lib.mkIf config.persistence.enable {
    "/persist" = {
      directories = [
        "/var/lib/docker"
      ];
    };
  };
}
1 Like