In commit 9a36187 the /api/healthz was added to resolve issue #226; I used this feature to use the Docker health check functionality.
There should be two ways to do it:
Add --health-cmd to docker run or healthcheck to docker-compose file
Add it to the Dockerfile so it is enabled by default
I went for the second option as you can change the details of the healtz endpoint without having to change every user's configuration.
I set the timeout, start-period and interval arbitrarily, can be changed as you like.
Example
The healthcheck works even if external port is changed, I tested mine with port 8045.
As the container is starting the status is "starting"
IMAGE COMMAND CREATED STATUS PORTS
cremaluca/glance:0.0.1 "/app/glance" 4 seconds ago Up 3 seconds (health: starting) 0.0.0.0:8045->8080/tcp, [::]:8045->8080/tcp
But after a few seconds it has already changed to healthy
IMAGE COMMAND CREATED STATUS PORTS
cremaluca/glance:0.0.1 "/app/glance" 9 seconds ago Up 8 seconds (healthy) 0.0.0.0:8045->8080/tcp, [::]:8045->8080/tcp
In commit 9a36187 the /api/healthz was added to resolve issue #226; I used this feature to use the Docker health check functionality.
There should be two ways to do it:
--health-cmd
todocker run
orhealthcheck
todocker-compose
fileI went for the second option as you can change the details of the healtz endpoint without having to change every user's configuration.
I set the
timeout
,start-period
andinterval
arbitrarily, can be changed as you like.Example
The healthcheck works even if external port is changed, I tested mine with port 8045.
As the container is starting the status is "starting"
But after a few seconds it has already changed to healthy