nlewo / nix2container

An archive-less dockerTools.buildImage implementation
Apache License 2.0
501 stars 45 forks source link

How to run image i build? #103

Open blazp7 opened 8 months ago

blazp7 commented 8 months ago

Hello, i am struggling to run the image in a declarative way after it was built with nix2container. Advice appreciated.

let
    nix2containerPkgs = nix2container.packages.x86_64-linux;
    myappImage = packages.x86_64-linux.hello = nix2containerPkgs.nix2container.buildImage {
      name = "hello";
      config = {
        entrypoint = ["${pkgs.hello}/bin/hello"];
      };
    };
in {
  virtualisation.oci-containers.containers.myapp-container = {
    image = myappImage  # this doesnt work 
    ....
  };
nlewo commented 8 months ago

@blazp7 I don't know what kind of artifacts has to be the value of your image attribute. If you need a tar.gz file, you would have to build a derivation running something such as myappImage.copyTo docker-archive://$out.