nix2container
nix2container copied to clipboard
Request: easy way to get resulting image name
After
nix run .#dockerImage.copyToDockerDaemon
I want to run the image - I found this hacky way:
docker run (nix eval --impure --expr '(builtins.getFlake (toString ./.)).outputs.packages.x86_64-linux.dockerImage.imageRefUnsafe' --json | jq -r)
Could there be a simpler way? (or is there already?)
e.g. nix run .#dockerImage.printImageRef :tipping_hand_man:
I adapted my taskfile to just print the image ref to ./result - so I can
docker run $(cat result)
But I guess that doesn't quite fit a nix run cli :thinking: (and nix2container isn't really meant for nix build, is it?)
Found that I can set:
nix2container.buildImage {
tag = "latest";
and then docker run image:latest
is this good practice? Not sure what other gotchas this might have :thinking: