code: def list_containers(**kwargs):
      '''
      Returns a list of containers by name. This is different from
      :py:func:`docker.ps <salt.modules.dockermod.ps_>` in that
      :py:func:`docker.ps <salt.modules.dockermod.ps_>` returns its results
      organized by container ID.
  
      all : False
          If ``True``, stopped containers will be included in return data
  
      CLI Example:
  
      .. code-block:: bash
  
          salt myminion docker.inspect_image <image>
      '''
      ret = set()
      for item in six.itervalues(ps_(all=kwargs.get('all', False))):
          names = item.get('Names')
          if not names:
              continue
          for c_name in [x.lstrip('/') for x in names or []]:
              ret.add(c_name)
      return sorted(retf list_containers(**kwargs):
      '''
      Returns a list of containers by name. This is different from
      :py:func:`docker.ps <salt.modules.dockermod.ps_>` in that
      :py:func:`docker.ps <salt.modules.dockermod.ps_>` returns its results
      organized by container ID.
  
      all : False
          If ``True``, stopped containers will be included in return data
  
      CLI Example:
  
      .. code-block:: bash
  
          salt myminion docker.inspect_image <image>
      '''
      ret = set()
      for item in six.itervalues(ps_(all=kwargs.get('all', False))):
          names = item.get('Names')
          if not names:
              continue
          for c_name in [x.lstrip('/') for x in names or []]:
              ret.add(c_name)
      return sorted(ret)
docs: Returns a list of containers by name. This is different from
      :py:func:`docker.ps <salt.modules.dockermod.ps_>` in that
      :py:func:`docker.ps <salt.modules.dockermod.ps_>` returns its results
      organized by container ID.
  
      all : False
          If ``True``, stopped containers will be included in return data
  
      CLI Example:
  
      .. code-block:: bash
  
          salt myminion docker.inspect_image <image>