Skip to content

Commit be5c203

Browse files
fix: handle DOS-style path for Dockerfile in minikube build
1 parent aca5f29 commit be5c203

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/minikube/cmd/image.go

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"k8s.io/minikube/pkg/minikube/exit"
3131
"k8s.io/minikube/pkg/minikube/image"
3232
"k8s.io/minikube/pkg/minikube/machine"
33+
"k8s.io/minikube/pkg/minikube/out"
3334
"k8s.io/minikube/pkg/minikube/reason"
3435
docker "k8s.io/minikube/third_party/go-dockerclient"
3536
)
@@ -310,6 +311,12 @@ var buildImageCmd = &cobra.Command{
310311
// Otherwise, assume it's a tar
311312
}
312313
}
314+
if runtime.GOOS == "windows" && strings.Contains(dockerFile, "\\") {
315+
// if dockerFile is a DOS path, translate it into UNIX path
316+
// because we are going to build this image in UNIX environment
317+
out.String("minikube detects that you are using DOS-style path %s. Minikube will convert it to UNIX-style by replacing all \\ to /", dockerFile)
318+
dockerFile = strings.ReplaceAll(dockerFile, "\\", "/")
319+
}
313320
if err := machine.BuildImage(img, dockerFile, tag, push, buildEnv, buildOpt, []*config.Profile{profile}, allNodes, nodeName); err != nil {
314321
exit.Error(reason.GuestImageBuild, "Failed to build image", err)
315322
}

0 commit comments

Comments
 (0)