Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: easy way to get resulting image name #111

Open
tennox opened this issue Jan 20, 2024 · 2 comments
Open

Request: easy way to get resulting image name #111

tennox opened this issue Jan 20, 2024 · 2 comments

Comments

@tennox
Copy link

tennox commented Jan 20, 2024

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 💁‍♂️

@tennox
Copy link
Author

tennox commented Jan 20, 2024

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 🤔 (and nix2container isn't really meant for nix build, is it?)

@tennox
Copy link
Author

tennox commented Jan 21, 2024

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 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant