Docker Community Forums

Share and learn in the Docker community.

Health status in container inspection

Hi,

I have a simple question regarding https://docs.docker.com/engine/api/v1.40/#operation/ContainerInspect
In API 1.40 the health status is documented to be available in State.Status.Health

In API 1.39, the health status in not documented but seems to be there (I’ve tested with a docker engine 18.09)

The question is, is that feature present and not documented in 1.39 and present, as in 1.39 and documented in 1.40 ?

Or the behaviour in 1.39 is a preview/beta and the only official release is in 1.40.

Here are my findings until now, small hint, I am completly a go noob.

Starting from the swagger we get the operation behind the rest call :
ContainerInspect

From there, I find an interface that expose the ContainerInspect method.
Then, into components/engine/api/server/router/container/inspect.go I think I found the actual call to inspect REST calls.

After that I’m not sure to follow the right track, but at the end I think/hope we are in components/engine/daemon/inspect.go with this call

base, err := daemon.getInspectData(container)

And finally this code

var containerHealth *types.Health
if container.State.Health != nil {
                    containerHealth = &types.Health{
 			Status:        container.State.Health.Status(),
 			FailingStreak: container.State.Health.FailingStreak,
 			Log:           append([]*types.HealthcheckResult{}, container.State.Health.Log...),
 		}
 	}

Whitch seems to include health status even with a 1.40 API (the call response seems to be completly decoralated from the API version)

If someone can confirm, on not, my poor go reading I’ll be very glad :slight_smile: