code: func (daemon *Daemon) Kill(container *containerpkg.Container) error {
  	if !container.IsRunning() {
  		return errNotRunning(container.ID)
  	}
  
  	// 1. Send SIGKILL
  	if err := daemon.killPossiblyDeadProcess(container, int(syscall.SIGKILL)); err != nil {
  		// While normally we might "return err" here we're not going to
  		// because if we can't stop the container by this point then
  		// it's probably because it's already stopped. Meaning, between
  		// the time of the IsRunning() call above and now it stopped.
  		// Also, since the err return will be environment specific we can't
  		// look for any particular (common) error that would indicate
  		// that the process is already dead vs something else going wrong.
  		// So, instead we'll give it up to 2 more seconds to complete and if
  		// by that time the container is still running, then the error
  		// we got is probably valid and so we return it to the caller.
  		if isErrNoSuchProcess(err) {
  			return nil
  		}
  
  		ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
  		defer cancel()
  
  		if status := <-container.Wait(ctx, containerpkg.WaitConditionNotRunning); status.Err() != nil {
  			return err
  		}
  	}
  
  	// 2. Wait for the process to die, in last resort, try to kill the process directly
  	if err := killProcessDirectly(container); err != nil {
  		if isErrNoSuchProcess(err) {
  			return nil
  		}
  		return err
  	}
  
  	// Wait for exit with no timeout.
  	// Ignore returned status.
  	<-container.Wait(context.Background(), containerpkg.WaitConditionNotRunning)
  
  	return nil
  }
docs: // Kill forcefully terminates a container.