mirror of https://github.com/docker/docs.git
Update container state (from PR samalba/dockerclient#/236)
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
parent
859c710bdd
commit
0b75203143
|
|
@ -21,6 +21,7 @@ type Container struct {
|
||||||
|
|
||||||
// StateString returns a single string to describe state
|
// StateString returns a single string to describe state
|
||||||
func StateString(state *types.ContainerState) string {
|
func StateString(state *types.ContainerState) string {
|
||||||
|
startedAt, _ := time.Parse(time.RFC3339Nano, state.StartedAt)
|
||||||
if state.Running {
|
if state.Running {
|
||||||
if state.Paused {
|
if state.Paused {
|
||||||
return "paused"
|
return "paused"
|
||||||
|
|
@ -35,6 +36,10 @@ func StateString(state *types.ContainerState) string {
|
||||||
return "dead"
|
return "dead"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if startedAt.IsZero() {
|
||||||
|
return "created"
|
||||||
|
}
|
||||||
|
|
||||||
return "exited"
|
return "exited"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,6 +61,10 @@ func FullStateString(state *types.ContainerState) string {
|
||||||
return "Dead"
|
return "Dead"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if startedAt.IsZero() {
|
||||||
|
return "Created"
|
||||||
|
}
|
||||||
|
|
||||||
if finishedAt.IsZero() {
|
if finishedAt.IsZero() {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue