From 6a7f14ea01974a59eec8b3d815536c93a90f55b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Mon, 4 Apr 2022 20:14:23 +0200 Subject: [PATCH] Use the right port for docker in qemu driver --- cmd/minikube/cmd/docker-env.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/minikube/cmd/docker-env.go b/cmd/minikube/cmd/docker-env.go index 2a4efb31c0df..9f4127518858 100644 --- a/cmd/minikube/cmd/docker-env.go +++ b/cmd/minikube/cmd/docker-env.go @@ -38,6 +38,7 @@ import ( "k8s.io/klog/v2" "k8s.io/minikube/pkg/drivers/kic/oci" + "k8s.io/minikube/pkg/drivers/qemu" "k8s.io/minikube/pkg/minikube/bootstrapper/bsutil/kverify" "k8s.io/minikube/pkg/minikube/command" "k8s.io/minikube/pkg/minikube/constants" @@ -290,11 +291,13 @@ var dockerEnvCmd = &cobra.Command{ d := co.CP.Host.Driver port := constants.DockerDaemonPort - if driver.NeedsPortForward(driverName) { + if driver.NeedsPortForward(driverName) && driver.IsKIC(driverName) { port, err = oci.ForwardedPort(driverName, cname, port) if err != nil { exit.Message(reason.DrvPortForward, "Error getting port binding for '{{.driver_name}} driver: {{.error}}", out.V{"driver_name": driverName, "error": err}) } + } else if driver.NeedsPortForward(driverName) && driverName == driver.QEMU2 { + port = d.(*qemu.Driver).EnginePort } hostname, err := d.GetSSHHostname()