github.com/gunjan5/docker@v1.8.2/daemon/kill.go (about) 1 package daemon 2 3 import "syscall" 4 5 // ContainerKill send signal to the container 6 // If no signal is given (sig 0), then Kill with SIGKILL and wait 7 // for the container to exit. 8 // If a signal is given, then just send it to the container and return. 9 func (daemon *Daemon) ContainerKill(name string, sig uint64) error { 10 container, err := daemon.Get(name) 11 if err != nil { 12 return err 13 } 14 15 // If no signal is passed, or SIGKILL, perform regular Kill (SIGKILL + wait()) 16 if sig == 0 || syscall.Signal(sig) == syscall.SIGKILL { 17 if err := container.Kill(); err != nil { 18 return err 19 } 20 } else { 21 // Otherwise, just send the requested signal 22 if err := container.KillSig(int(sig)); err != nil { 23 return err 24 } 25 } 26 return nil 27 }