github.com/dougm/docker@v1.5.0/daemon/execdriver/native/info.go (about) 1 // +build linux,cgo 2 3 package native 4 5 import ( 6 "os" 7 "path/filepath" 8 9 "github.com/docker/libcontainer" 10 ) 11 12 type info struct { 13 ID string 14 driver *driver 15 } 16 17 // IsRunning is determined by looking for the 18 // pid file for a container. If the file exists then the 19 // container is currently running 20 func (i *info) IsRunning() bool { 21 if _, err := libcontainer.GetState(filepath.Join(i.driver.root, i.ID)); err == nil { 22 return true 23 } 24 // TODO: Remove this part for version 1.2.0 25 // This is added only to ensure smooth upgrades from pre 1.1.0 to 1.1.0 26 if _, err := os.Stat(filepath.Join(i.driver.root, i.ID, "pid")); err == nil { 27 return true 28 } 29 return false 30 }