diff --git a/cmd/finch/main.go b/cmd/finch/main.go index 0e77be70c..b605b2313 100644 --- a/cmd/finch/main.go +++ b/cmd/finch/main.go @@ -45,7 +45,7 @@ func initializeNerdctlCommands( allNerdctlCommands = append(allNerdctlCommands, nerdctlCommandCreator.create(cmdName, cmdDescription)) } - if fc.DockerCompat { + if fc != nil && fc.DockerCompat { for cmdName, cmdDescription := range dockerCompatCmds { allNerdctlCommands = append(allNerdctlCommands, nerdctlCommandCreator.create(cmdName, cmdDescription)) } diff --git a/cmd/finch/nerdctl.go b/cmd/finch/nerdctl.go index 996535a18..cfeaf040b 100644 --- a/cmd/finch/nerdctl.go +++ b/cmd/finch/nerdctl.go @@ -249,7 +249,7 @@ var cmdFlagSetMap = map[string]map[string]sets.Set[string]{ // converts "docker build --load" flag to "nerdctl build --output=type=docker". func handleDockerBuildLoad(_ NerdctlCommandSystemDeps, fc *config.Finch, nerdctlCmdArgs []string, index int) error { - if fc.DockerCompat { + if fc != nil && fc.DockerCompat { nerdctlCmdArgs[index] = "--output=type=docker" } @@ -280,7 +280,7 @@ func handleBuildx(_ NerdctlCommandSystemDeps, fc *config.Finch, cmdName *string, } func handleDockerCompatInspect(_ NerdctlCommandSystemDeps, fc *config.Finch, cmdName *string, args *[]string) error { - if !fc.DockerCompat { + if fc == nil || !fc.DockerCompat { return nil }