def run(image, name=None, command=None, environment=None, ports=None, volumes=None):
    '''
    Run a docker container.

    Args:
        * image: Docker image to run, e.g. orchardup/redis, quay.io/hello/world
        * name=None: Container name
        * command=None: Command to execute
        * environment: Comma separated environment variables in the format NAME=VALUE
        * ports=None: Comma separated port specs in the format CONTAINER_PORT[:EXPOSED_PORT][/PROTOCOL]
        * volumes=None: Comma separated volumes in the format HOST_DIR:CONTAINER_DIR

    Examples:
        * fab docker.run:orchardup/redis,name=redis,ports=6379
        * fab docker.run:quay.io/hello/world,name=hello,ports="80:8080,1000/udp",volumes="/docker/hello/log:/var/log"
        * fab docker.run:andreasjansson/redis,environment="MAX_MEMORY=4G,FOO=bar",ports=6379
    '''

    if ports and not name:
        abort('The ports flag currently only works if you specify a container name')

    if ports:
        ports = [parse_port_spec(p) for p in ports.split(',')]
    else:
        ports = None
    if environment:
        environment = dict([x.split('=') for x in environment.split(',')])
    else:
        environment = None
    if volumes:
        volumes = dict([x.split(':') for x in volumes.split(',')])
    else:
        volumes = None

    run_container(
        image=image,
        name=name,
        command=command,
        ports=ports,
        environment=environment,
        volumes=volumes,
    )
Run a docker container.

    Args:
        * image: Docker image to run, e.g. orchardup/redis, quay.io/hello/world
        * name=None: Container name
        * command=None: Command to execute
        * environment: Comma separated environment variables in the format NAME=VALUE
        * ports=None: Comma separated port specs in the format CONTAINER_PORT[:EXPOSED_PORT][/PROTOCOL]
        * volumes=None: Comma separated volumes in the format HOST_DIR:CONTAINER_DIR

    Examples:
        * fab docker.run:orchardup/redis,name=redis,ports=6379
        * fab docker.run:quay.io/hello/world,name=hello,ports="80:8080,1000/udp",volumes="/docker/hello/log:/var/log"
        * fab docker.run:andreasjansson/redis,environment="MAX_MEMORY=4G,FOO=bar",ports=6379