aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2017-05-10 08:18:49 -0400
committerAdam Stokes <battlemidget@users.noreply.github.com>2017-05-10 08:18:49 -0400
commitad26d98086ba516a28ce9d3c166da70807cdeb97 (patch)
treee7997c3bc4d9407a3c0048f2ec8cd8e08fd42cbc
parent2c0bf8b2581dbe31ea5bebcbdae8cdf62a3e92c7 (diff)
downloadsos-ad26d98086ba516a28ce9d3c166da70807cdeb97.tar.gz
[docker] Collect image inspect output (#995)
Adds output for 'docker inspect' for each unique image on the host. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Adam Stokes <battlemidget@users.noreply.github.com>
-rw-r--r--sos/plugins/docker.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/sos/plugins/docker.py b/sos/plugins/docker.py
index ffe5cfce..6e5a0b2e 100644
--- a/sos/plugins/docker.py
+++ b/sos/plugins/docker.py
@@ -77,10 +77,18 @@ class Docker(Plugin):
if self.get_option('all'):
ps_cmd = "{0} -a".format(ps_cmd)
- result = self.get_command_output(ps_cmd)
- if result['status'] == 0:
- containers = [c for c in result['output'].splitlines()]
- for container in containers:
+ img_cmd = '{0} images -q'.format(self.docker_cmd)
+ insp = set()
+
+ for icmd in [ps_cmd, img_cmd]:
+ result = self.get_command_output(icmd)
+ if result['status'] == 0:
+ for con in result['output'].splitlines():
+ insp.add(con)
+
+ insp = list(insp)
+ if insp:
+ for container in insp:
self.add_cmd_output(
"{0} inspect {1}".format(
self.docker_cmd,