Fixes the issue which caused all containers to be deleted on delete

This change only involves the docker container runtime.
pull/4689/head
Nabarun Pal 2019-07-05 13:28:19 +05:30
parent 4e5f173a9c
commit 67874eee9e
No known key found for this signature in database
GPG Key ID: 611D5079D826B150
1 changed files with 4 additions and 0 deletions

View File

@ -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