.. versionadded:: 2018.3.0

    Return a list of running containers attached to the specified network

    name
        Network name

    verbose : False
        If ``True``, return extended info about each container (IP
        configuration, etc.)

    CLI Example:

    .. code-block:: bash

        salt myminion docker.connected net_name

def connected(name, verbose=False):
    '''
    .. versionadded:: 2018.3.0

    Return a list of running containers attached to the specified network

    name
        Network name

    verbose : False
        If ``True``, return extended info about each container (IP
        configuration, etc.)

    CLI Example:

    .. code-block:: bash

        salt myminion docker.connected net_name
    '''
    containers = inspect_network(name).get('Containers', {})
    ret = {}
    for cid, cinfo in six.iteritems(containers):
        # The Containers dict is keyed by container ID, but we want the results
        # to be keyed by container name, so we need to pop off the Name and
        # then add the Id key to the cinfo dict.
        try:
            name = cinfo.pop('Name')
        except (KeyError, AttributeError):
            # Should never happen
            log.warning(
                '\'Name\' key not present in container definition for '
                'container ID \'%s\' within inspect results for Docker '
                'network \'%s\'. Full container definition: %s',
                cid, name, cinfo
            )
            continue
        else:
            cinfo['Id'] = cid
            ret[name] = cinfo
    if not verbose:
        return list(ret)
    return ret