Let's rebuild and run our container.
docker build -t docker-flask .
docker run --rm --name docker-flask -p 5000:5000 docker-flask
Now let's take a look at the health status. Notice we have the --name option to the above command so we can easily inspect the container.
docker inspect --format='{{json .State.Health}}' docker-flask
If you run this immediately after the container starts, you'll see Status is starting.
{"Status":"starting","FailingStreak":0,"Log":[]}
And after the health check runs (after the default interval of 30s):
{"Status":"healthy","FailingStreak":0,"Log":[{"Start":"2017-07-21T06:10:51.809087707Z","End":"2017-07-21T06:10:51.868940223Z","ExitCode":0,"Output":"Hello world"}]}
We have a little more information here. We see the Status is healthy as well as some details about the health check.
We can also see the health status by running docker ps.
docker ps
You'll see the following:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9f89662fc56a howchoo/docker-flask "python app.py" 2 minutes ago Up 2 minutes (healthy) 0.0.0.0:5555->5000/tcp docker-flask
Notice under STATUS, the status is Up with (healthy) next to it. The health status appears only when a health check is configured.