@sonic_installer.command('rollback-docker')
@click.option('-y', '--yes', is_flag=True, callback=abort_if_false, expose_value=False, prompt='Docker image will be rolled back, continue?')
@click.argument('container_name', metavar='<container_name>', required=True, type=click.Choice(DOCKER_CONTAINER_LIST))
def rollback_docker(container_name):
    ' Rollback docker image to previous version'
    if ('rollback_docker' in sys.argv):
        print_deprecation_warning('rollback_docker', 'rollback-docker')
    image_name = get_container_image_name(container_name)
    image_id_all = get_container_image_id_all(image_name)
    if (len(image_id_all) != 2):
        echo_and_log("Two images required, but there are '{}' images for '{}'. Aborting...".format(len(image_id_all), image_name), LOG_ERR)
        raise click.Abort()
    image_latest = (image_name + ':latest')
    image_id_previous = get_container_image_id(image_latest)
    version_tag = ''
    for id in image_id_all:
        if (id != image_id_previous):
            version_tag = get_docker_tag_name(id)
    run_command(('docker tag %s:%s %s:latest' % (image_name, version_tag, image_name)))
    if ((container_name == 'swss') or (container_name == 'bgp') or (container_name == 'teamd')):
        echo_and_log("Cold reboot is required to restore system state after '{}' rollback !!".format(container_name), LOG_ERR)
    else:
        run_command(('systemctl restart %s' % container_name))
    echo_and_log('Done')
Rollback docker image to previous version
@sonic_installer.command('rollback-docker')
@click.option('-y', '--yes', is_flag=True, callback=abort_if_false, expose_value=False, prompt='Docker image will be rolled back, continue?')
@click.argument('container_name', metavar='<container_name>', required=True, type=click.Choice(DOCKER_CONTAINER_LIST))
def rollback_docker(container_name):
    ' '
    if ('rollback_docker' in sys.argv):
        print_deprecation_warning('rollback_docker', 'rollback-docker')
    image_name = get_container_image_name(container_name)
    image_id_all = get_container_image_id_all(image_name)
    if (len(image_id_all) != 2):
        echo_and_log("Two images required, but there are '{}' images for '{}'. Aborting...".format(len(image_id_all), image_name), LOG_ERR)
        raise click.Abort()
    image_latest = (image_name + ':latest')
    image_id_previous = get_container_image_id(image_latest)
    version_tag = 
    for id in image_id_all:
        if (id != image_id_previous):
            version_tag = get_docker_tag_name(id)
    run_command(('docker tag %s:%s %s:latest' % (image_name, version_tag, image_name)))
    if ((container_name == 'swss') or (container_name == 'bgp') or (container_name == 'teamd')):
        echo_and_log("Cold reboot is required to restore system state after '{}' rollback !!".format(container_name), LOG_ERR)
    else:
        run_command(('systemctl restart %s' % container_name))
    echo_and_log('Done')