def sort_dependencies(self, image, dependencies=None):
        if dependencies is None:
            dependencies = OrderedDict()
        if image in dependencies:
            return
        requires = self.ymldefs[image].get('requires', [])
        for dep in requires:
            self.sort_dependencies(dep, dependencies)
        dependencies[image] = None
        return dependencies.keys()