I'm trying to use a Docker HEALTHCHECK in a container. I'm setting that up in a version 3 docker-compose file, which also supports healthcheck:
version: '3'
services:
api:
[...]
healthcheck:
test: test ! -e /unhealthy
interval: 10s
timeout: 1s
retries: 1
In every place I can find, including on stackoverflow, the way to check the health of a container is to use docker inspect and look at State.Health, but no such entry exists:
$ docker inspect --format='{{json .State}}' api
Template parsing error: template: :1:7: executing "" at <.State>: map has no entry for key "State"
I googled around for quite a while but cannot see where this information moved to or any alternate ways to check health status.
Version info:
$ docker-compose --version
docker-compose version 1.16.1, build 6d1ac219
$ docker --version
Docker version 17.09.0-ce, build afdb6d4