def kill(container, signal=None):
    client = _get_client()
    status = base_status.copy()
    try:
        dcontainer = _get_container_infos(container)['Id']
        if is_running(dcontainer):
            client.kill(dcontainer, signal=signal)
            if signal:
                # no need to check if container is running
                # because some signals might not stop the container.
                _valid(status,
                       comment='Kill signal \'{0}\' successfully'
                       ' sent to the container \'{1}\''.format(signal, container),
                       id_=container)
            else:
                if not is_running(dcontainer):
                    _valid(status,
                           comment='Container {0} was killed'.format(container),
                           id_=container)
                else:
                    _invalid(status,
                             comment='Container {0} was not killed'.format(
                                 container))
        else:
            _valid(status,
                   comment='Container {0} was already stopped'.format(
                       container),
                   id_=container)
    except Exception:
        _invalid(status,
                 id_=container,
                 out=traceback.format_exc(),
                 comment=(
                     'An exception occurred while killing '
                     'your container {0}').format(container))
    __salt__['mine.send']('dockerng.ps', verbose=True, all=True, host=True)
    return status
Kill a running container
dataset/ETHPy150Open saltstack/salt/salt/modules/dockerio.py/kill