mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Add Health attribute on the docker ps command
Signed-off-by: Muhammad Daffa Dinaya <muhammaddaffadinaya@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
committed by
Sebastiaan van Stijn
parent
81caabae43
commit
6e7a2c830d
@@ -296,9 +296,17 @@ func (v *View) GetAllNames() map[string][]string {
|
||||
// A lock on the Container is not held because these are immutable deep copies.
|
||||
func (v *View) transform(ctr *Container) *Snapshot {
|
||||
health := container.NoHealthcheck
|
||||
failingStreak := 0
|
||||
if ctr.Health != nil {
|
||||
health = ctr.Health.Status()
|
||||
failingStreak = ctr.Health.FailingStreak
|
||||
}
|
||||
|
||||
healthSummary := &container.HealthSummary{
|
||||
Status: health,
|
||||
FailingStreak: failingStreak,
|
||||
}
|
||||
|
||||
snapshot := &Snapshot{
|
||||
Summary: container.Summary{
|
||||
ID: ctr.ID,
|
||||
@@ -308,6 +316,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
Mounts: ctr.GetMountPoints(),
|
||||
State: ctr.State.StateString(),
|
||||
Status: ctr.State.String(),
|
||||
Health: healthSummary,
|
||||
Created: ctr.Created.Unix(),
|
||||
},
|
||||
CreatedAt: ctr.Created,
|
||||
|
||||
Reference in New Issue
Block a user