def dockerfile_from_image(ID, cli):
    """Return list of commands used to create image 'ID'. These
    commands is an output from docker history.
    """
    info = cli.inspect_image(ID)
    commands = []
    history = cli.history(ID)
    for item in history:
        if '/bin/sh -c #(nop) ' in item['CreatedBy']:
            commands.append(item['CreatedBy'][18:])
        else:
            commands.append(item['CreatedBy'])
    commands.reverse()
    return commands
