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

nvidia-container-runtime usage example is broken/incorrect #781

Open
gflarity opened this issue Nov 8, 2024 · 2 comments
Open

nvidia-container-runtime usage example is broken/incorrect #781

gflarity opened this issue Nov 8, 2024 · 2 comments

Comments

@gflarity
Copy link

gflarity commented Nov 8, 2024

The nvidia-container-runtime usage example is broke/incorrect: https://github.com/NVIDIA/nvidia-container-toolkit/tree/main/cmd/nvidia-container-runtime#usage-example

It doesn't work and if you set the log level to 'trace' and you look in the logs you'll find:

time="2024-11-08T12:50:03-05:00" level=trace msg="Skipping modifier for non-create subcommand"

This is caused by the this function:

func HasCreateSubcommand(args []string) bool {

Here's the code

// HasCreateSubcommand checks the supplied arguments for a 'create' subcommand
func HasCreateSubcommand(args []string) bool {
	var previousWasBundle bool
	for _, a := range args {
		// We check for '--bundle create' explicitly to ensure that we
		// don't inadvertently trigger a modification if the bundle directory
		// is specified as `create`
		if !previousWasBundle && IsBundleFlag(a) {
			previousWasBundle = true
			continue
		}

		if !previousWasBundle && a == "create" {
			return true
		}

		previousWasBundle = false
	}

	return false
}

As far as I can tell, the only way this function will ever return true is if you run sudo nvidia-container-runtime create first. I think the intention was that if you specify --bundle explicitly it would also work? Not sure, it's a bit hard understand what the bundle flag stuff actually accomplishes.

In any event, I thought I'd file an issue incase someone else runs apon this and wonders why it doesn't work. Once you run create the spec gets modified properly and you can use it with 'run' if you want.

@Nativu5
Copy link

Nativu5 commented Nov 12, 2024

Same here. I was trying nvidia-container-runtime run ubuntu, but it turned out config.json left unmodified. The code mentioned above ignores all subcommands except create.

I think that's why the example doesn't work anymore. Has support for nvidia-container-runtime run <container_id> been intentionally deprecated?

@gflarity
Copy link
Author

Run will just pass through without modification. Only create will modify. Not sure if that function I posted is buggy or this is intentional.

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

2 participants