def find_dependencies(name, images):
    """
    Finds the dependencies of name in the
    images dictionary and returns an array
    of all keys in images that should be built

    :param name: The name of the image to build
    :type name: string

    :param images: The dictionary of images
    :type images: dict(string: image_definition)
    """
    names = []
    curname = name
    while 'from' in images[curname]:
        names.append(curname)
        curname = images[curname]['from']
    names.append(curname)
    return names
