Podman

From NixOS Wiki
Revision as of 08:46, 21 January 2020 by imported>Eoli3n

Podman can run rootless docker containers

Install podman

{ pkgs, ... }:
{
  environment.systemPackages = with pkgs; [ podman runc conmon slirp4netns fuse-overlayfs ];
}

Configure subuid/subgid for your user

{
  users.users.username.subUidRanges = [{ startUid = 100000; count = 65536; }];
  users.users.username.subGidRanges = [{ startGid = 100000; count = 65536; }];
}

Create configuration files

{
  environment.etc."containers/policy.json" = {
    mode="0644";
    text=''
      {
        "default": [
          {
            "type": "insecureAcceptAnything"
          }
        ],
        "transports":
          {
            "docker-daemon":
              {
                "": [{"type":"insecureAcceptAnything"}]
              }
          }
      }
    '';
  };

  environment.etc."containers/registries.conf" = {
    mode="0644";
    text=''
      [registries.search]
      registries = ['docker.io', 'quay.io']
    '';
  };
}