github.com/dpiddy/docker@v1.12.2-rc1/daemon/unpause.go (about) 1 package daemon 2 3 import ( 4 "fmt" 5 6 "github.com/docker/docker/container" 7 ) 8 9 // ContainerUnpause unpauses a container 10 func (daemon *Daemon) ContainerUnpause(name string) error { 11 container, err := daemon.GetContainer(name) 12 if err != nil { 13 return err 14 } 15 16 if err := daemon.containerUnpause(container); err != nil { 17 return err 18 } 19 20 return nil 21 } 22 23 // containerUnpause resumes the container execution after the container is paused. 24 func (daemon *Daemon) containerUnpause(container *container.Container) error { 25 container.Lock() 26 defer container.Unlock() 27 28 // We cannot unpause the container which is not running 29 if !container.Running { 30 return errNotRunning{container.ID} 31 } 32 33 // We cannot unpause the container which is not paused 34 if !container.Paused { 35 return fmt.Errorf("Container %s is not paused", container.ID) 36 } 37 38 if err := daemon.containerd.Resume(container.ID); err != nil { 39 return fmt.Errorf("Cannot unpause container %s: %s", container.ID, err) 40 } 41 42 return nil 43 }