Created
December 2, 2014 20:57
-
-
Save ewindisch/3847a7233a08b63cde73 to your computer and use it in GitHub Desktop.
Dockerfile-ish output from image (from cwd of a 'docker save' extraction)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json | |
import sys | |
img_id = sys.argv[1] | |
#json_f = open("%s/json" % head) | |
#img_json = json.load(json_f) | |
#json_f.close() | |
traversal_list = [img_id] | |
while True: | |
json_f = open("%s/json" % img_id) | |
img_json = json.load(json_f) | |
json_f.close() | |
parent = img_json.get('parent', None) | |
if parent is None: | |
break | |
traversal_list.append(parent) | |
img_id = parent | |
traversal_list.reverse() | |
print "Created image hierarchy" | |
print traversal_list | |
for img_id in traversal_list: | |
json_f = open("%s/json" % img_id) | |
img_json = json.load(json_f) | |
json_f.close() | |
parent = img_json.get('parent', None) | |
if parent is None: | |
for k, val in img_json['container_config'].iteritems(): | |
print k, val | |
continue | |
parent_json_f = open("%s/json" % parent) | |
parent_json = json.load(parent_json_f) | |
parent_json_f.close() | |
for k, val in img_json['container_config'].iteritems(): | |
if k == "Image": | |
continue | |
if not k in parent_json.get('container_config', {}): | |
print k, val | |
continue | |
if val != parent_json.get('container_config', {})[k]: | |
print k, val | |
continue | |
img_json = parent_json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment