{"record":{"id":"d58c932a5c733bc7","repo":"abiosoft/colima","slug":"nerdctl-only-supports-s-runtime","errorCode":null,"errorMessage":"nerdctl only supports %s runtime","messagePattern":"nerdctl only supports (.+?) runtime","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/nerdctl.go","lineNumber":45,"sourceCode":"\n// nerdctlCmd represents the nerdctl command\nvar nerdctlCmd = &cobra.Command{\n\tUse:     \"nerdctl\",\n\tAliases: []string{\"nerd\", \"n\"},\n\tShort:   \"run nerdctl (requires containerd runtime)\",\n\tLong: `Run nerdctl to interact with containerd.\nThis requires containerd runtime.\n\nIt is recommended to specify '--' to differentiate from Colima flags.\n`,\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tapp := newApp()\n\t\tr, err := app.Runtime()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif r != containerd.Name {\n\t\t\treturn fmt.Errorf(\"nerdctl only supports %s runtime\", containerd.Name)\n\t\t}\n\n\t\t// collect CONTAINERD_* and NERDCTL_* environment variables from the host\n\t\tvar envVars []string\n\t\tfor _, env := range os.Environ() {\n\t\t\tif strings.HasPrefix(env, \"CONTAINERD_\") || strings.HasPrefix(env, \"NERDCTL_\") {\n\t\t\t\tenvVars = append(envVars, env)\n\t\t\t}\n\t\t}\n\n\t\tvar nerdctlArgs []string\n\t\tif len(envVars) > 0 {\n\t\t\t// use 'sudo env VAR=value ... nerdctl' to pass environment variables\n\t\t\tnerdctlArgs = append([]string{\"sudo\", \"env\"}, envVars...)\n\t\t\tnerdctlArgs = append(nerdctlArgs, \"nerdctl\")\n\t\t} else {\n\t\t\tnerdctlArgs = []string{\"sudo\", \"nerdctl\"}\n\t\t}","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/nerdctl.go#L27-L63","documentation":"`colima nerdctl` is a thin wrapper that execs nerdctl against containerd inside the guest; it first resolves app.Runtime() and hard-fails unless it equals containerd.Name ('containerd'). With the default docker runtime the guest runs the docker engine, not raw containerd, so nerdctl has nothing to talk to. There is no conversion layer — the runtime must have been chosen at `colima start` time.","triggerScenarios":"`colima nerdctl ...` on a VM started with the default `--runtime docker`; a config/profile whose runtime is docker; scripts assuming nerdctl works on any colima install.","commonSituations":"Following nerdctl tutorials against a stock colima install; mixing docker CLI workflows with nerdctl workflows on the same profile; forgetting that runtime is a start-time decision, not a per-command flag.","solutions":["Recreate the VM with containerd: `colima stop && colima delete && colima start --runtime containerd`, then `colima nerdctl -- version`","If you also need docker on that machine, use a separate profile: `colima start --profile nerd --runtime containerd`","Alternatively use the docker runtime's own CLI (`docker ...` via colima's socket) instead of nerdctl"],"exampleFix":"# before\n$ colima nerdctl -- version\nerror: nerdctl only supports containerd runtime\n\n# after\n$ colima stop && colima delete\n$ colima start --runtime containerd\n$ colima nerdctl -- version","handlingStrategy":"validation","validationCode":"// gate nerdctl usage on the VM's runtime\nstatus, _ := exec.Command(\"colima\", \"status\").CombinedOutput() // reports runtime\nif !strings.Contains(string(status), \"containerd\") {\n    // recreate: colima delete && colima start --runtime containerd\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide the runtime at `colima start` time; nerdctl requires `--runtime containerd` from VM creation","Use separate profiles if you need both docker and containerd workflows","Wrap colima nerdctl in scripts behind a runtime check so failures are explicit"],"tags":["colima","nerdctl","containerd","runtime","cli"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}