# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/redis.ipynb (unless otherwise specified).

__all__ = ['start']

# Cell
import scylla

def start(version='latest', port=None, **kwargs):
    image = "redis:{}".format(version)
    if port:
        ports = {6379: port}
    else:
        ports = [6379]
    additional_kwargs = {}
    additional_kwargs.update(kwargs)
    container = scylla.run_container(image, ports=ports,
                          **additional_kwargs)
    scylla.block_for_command(container, cmd='redis-cli ping')
    container = scylla.set_port_name(container, 6379, 'connection')
    return container