From bfc1201ecd049410cbf2a986eecf6dc753be15c0 Mon Sep 17 00:00:00 2001
From: James Cammarata <jimi@sngx.net>
Date: Mon, 12 May 2014 12:27:07 -0500
Subject: [PATCH] Make sure the docker data has a "Names" field before using it

Fixes #7363
---
 library/cloud/docker | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/library/cloud/docker b/library/cloud/docker
index f9aabf21a93..7cab18ff83c 100644
--- a/library/cloud/docker
+++ b/library/cloud/docker
@@ -507,7 +507,9 @@ class DockerManager:
             running_image, running_tag = self.get_split_image_tag(i['Image'])
             running_command = i['Command'].strip()
 
-            name_matches = (name and name in i['Names'])
+            name_matches = False
+            if i["Names"]:
+                name_matches = (name and name in i['Names'])
             image_matches = (running_image == image)
             tag_matches = (not tag or running_tag == tag)
             # if a container has an entrypoint, `command` will actually equal