From 67874eee9ecc4f864cab71d4070404c0f7b2ffd5 Mon Sep 17 00:00:00 2001 From: Nabarun Pal Date: Fri, 5 Jul 2019 13:28:19 +0530 Subject: [PATCH] Fixes the issue which caused all containers to be deleted on delete This change only involves the docker container runtime. --- pkg/minikube/cruntime/docker.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/minikube/cruntime/docker.go b/pkg/minikube/cruntime/docker.go index a113668eb6..a42e1d106c 100644 --- a/pkg/minikube/cruntime/docker.go +++ b/pkg/minikube/cruntime/docker.go @@ -25,6 +25,9 @@ import ( "k8s.io/minikube/pkg/minikube/console" ) +// KubernetesContainerPrefix is the prefix of each kubernetes container +const KubernetesContainerPrefix = "k8s_" + // Docker contains Docker runtime state type Docker struct { Socket string @@ -102,6 +105,7 @@ func (r *Docker) KubeletOptions() map[string]string { // ListContainers returns a list of containers func (r *Docker) ListContainers(filter string) ([]string, error) { + filter = KubernetesContainerPrefix + filter content, err := r.Runner.CombinedOutput(fmt.Sprintf(`docker ps -a --filter="name=%s" --format="{{.ID}}"`, filter)) if err != nil { return nil, err