pull/21741/merge
Henry Chen 2025-11-13 10:51:44 -08:00 committed by GitHub
commit a5adad0a2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 0 deletions

View File

@ -273,6 +273,10 @@ func runStart(cmd *cobra.Command, _ []string) {
validateBuiltImageVersion(starter.Runner, ds.Name)
if viper.GetBool(createMount) {
warnAboutMountFlag()
}
if existing != nil && driver.IsKIC(existing.Driver) && viper.GetString(mountString) != "" {
old := ""
if len(existing.ContainerVolumeMounts) > 0 {
@ -2104,3 +2108,22 @@ func startNerdctld(options *run.CommandOptions) {
exit.Error(reason.StartNerdctld, fmt.Sprintf("Failed to set up DOCKER_HOST: %s", rest.Output()), err)
}
}
func warnAboutMountFlag() {
homeDir, err := os.UserHomeDir()
if err != nil {
out.WarningT("Failed to get home directory: {{.err}}", out.V{"err": err})
}
// Detect usage of --mount without --mount-string
if viper.Get(mountString) == "" {
out.WarningT("The --mount flag is ignored.")
out.Styled(style.Tip, "To mount a host folder, please use the --mount-string flag.")
out.Styled(style.Option, "Example: minikube start --mount-string=\"{{.home}}/shared:/mnt/shared\"", out.V{"home": homeDir})
}
// Detect usage of --mount with --mount-string
if viper.Get(mountString) != "" {
out.WarningT("The --mount flag is ignored when --mount-string is specified and is not needed.")
}
}